High-code applications use the MCP (Model Context Protocol) to integrate various tools, which extends an AI agent's capabilities to include knowledge retrieval, external service calls, application orchestration, and data access.
Overview
On the Tools page for your high-code application, you can add and manage the agent's tools.
Adding tools in the console is for display and management only. The actual tool-calling logic must be implemented in your code using the MCP protocol.High-code applications support the following four types of tools:
Tool type | Description | Use cases |
|---|---|---|
Knowledge base | Publishing a configured knowledge base as an MCP service provides the agent with supplemental knowledge and improves response accuracy. | Scenarios that require domain-specific knowledge, such as product documentation Q&A, corporate knowledge retrieval, and automated FAQ responses. |
MCP service | Enable services from the MCP Marketplace or convert existing plugins to give the agent new skills. | External service call scenarios, such as web searches, weather queries, financial data analysis, and business information lookups. |
Application component | Integrate existing agents or workflows as components to provide your agent with more powerful capabilities. | Multi-agent collaboration, complex task orchestration, and reusing existing workflows in high-code applications. |
Data connector | A bridge on the Model Studio platform to external data, providing stable and secure enterprise-grade data services. | External data access scenarios, such as reading tabular data, file processing, and connecting to corporate databases. |
Recommended project structure
For a standard high-code application, we recommend the following project structure: tool_use_demo.zip.
requirements.txt file, we recommend pinning the version number for all dependencies using ==. Avoid using range constraints like >=. Pinning versions ensures a consistent dependency environment for every build, preventing build failures or runtime errors caused by upstream dependency updates.
Integration procedure
Integrating tools into a high-code application involves three steps:
- Step 1: Add a tool On the Tools page of your high-code application, select the required tool type (knowledge base, MCP service, application component, or data connector). Click the + button in the corresponding section, then search for and add the tool in the panel that appears.
-
Step 2: Integrate in code
After adding a tool, the system automatically configures the relevant environment variables. In your code, use
fastmcp.Clientto connect to the MCP service and call the tool. For example:
- Step 3: Deploy and verify Redeploy the application to apply the changes. Then, verify that the tool call works correctly in the API testing or Text Chat Experience panel on the right.
Knowledge base
A knowledge base provides an agent with domain-specific knowledge to improve response accuracy. You must first publish a configured knowledge base as an MCP service before a high-code application can call it.
Add a knowledge base
- On the Tools page, go to the Knowledge base section and click the + button to open the Select Knowledge Base panel.
- In the panel, search for or browse existing knowledge bases, and click Add to associate one with your application. To create a new one, click Create Knowledge Base.
- Once added, the knowledge base appears in the tool list. You can switch to the Added tab to view all associated knowledge bases.
MCP service
An MCP service enables an agent to call external skills. You can enable ready-made services from the MCP Marketplace, create a custom MCP service, or convert an existing plugin.
Add an MCP service
- On the Tools page, go to the MCP service section and click the + button to open the Select MCP Service panel.
-
In the panel, choose the source of the MCP service:
- MCP Marketplace: Browse and enable platform-provided MCP services, such as web search, financial data analysis, and business information lookups. You can filter by "Enabled" and "Not Enabled".
- Custom MCP: Add a self-created MCP service, or use Convert from Plugin to convert an existing plugin to an MCP service.
- Select the desired MCP service and click Add or Enable Now to complete the configuration.
Application component
Application components allow you to integrate existing agents or workflows as subcomponents into your current high-code application, enabling multi-agent collaboration and complex task orchestration.
Add an application component
- On the Tools page, go to the Application component section and click the + button to open the Select Application Component panel.
- In the panel, search for or browse existing agent and workflow applications, and click Add to integrate one as a component. To create a new application, click Create Application.
- Once added, the application component appears in the Added tab.
Data connector
On the Model Studio platform, data connectors act as a bridge for agents, workflows, and knowledge bases to access external data. They provide stable, secure, enterprise-grade data services.
Data files are transmitted over the public internet. Do not transfer sensitive data through data connectors.Add a data connector
- On the Tools page, go to the Data connector section and click the + button to open the Select Data Connector panel.
-
In the panel, select a data connector. The platform provides two default connectors:
- Default Table Connector: Used to read and process tabular data, such as CSV and Excel files.
- Default File Connector: Used to read and process various types of file data.
- Click Add to complete the configuration. To create a custom connector, click Create Connector.
MCP development essentials
All tools are integrated using the MCP (Model Context Protocol). The following are key points to consider when developing MCP tools.
Tool naming and description
The name and docstring of a tool function directly influence the large language model's decision to call it. They should accurately describe the tool's functionality and use cases.
Parameter definition
Provide clear type annotations and documentation for each parameter to help the large language model correctly extract and pass argument values.
Error handling
Tool functions should handle exceptions gracefully and return meaningful error messages instead of allowing unhandled exceptions to interrupt the conversation.
Environment variables
After you add a tool, the system automatically injects the necessary connection information into the runtime environment as environment variables. The following are commonly used system environment variables:
Environment variable | Description |
|---|---|
| The Model Studio API key, used to call model services and tool APIs. |
| Additional header information for API requests. |
| The system path variable, which includes the Python runtime path. |
| The Python module search path. |
| The time zone setting. |
You can view and edit all environment variables in the Deployment page's Environment Variables section. You can also confirm the environment variables injected for a new tool in this section.
FAQ
Q: What is the relationship between tools added in the console and tools in the code?
A: Adding a tool in the console is for declaring how the tool is called and managing its link to the application. The system also automatically injects the necessary environment variables. However, the actual tool-calling logic must be implemented in your code using the MCP protocol.
Q: How do I integrate a knowledge base into a high-code application?
A: First, create and configure the knowledge base on the Model Studio platform. Then, add it to your application on the Tools page. After adding it, the system automatically injects the knowledge base's connection information (such as its endpoint and ID). You then need to implement the retrieval logic in your code by calling the knowledge base's MCP service with fastmcp.Client.
Q: How do I use services from the MCP Marketplace?
A: Find the service you need in the MCP Marketplace and click Enable Now to activate it. Then, add it to your application on the Tools page. An enabled MCP service provides a standard calling interface. Use the environment variables in your code to get the connection information and call the service.
Q: Do I need to redeploy after adding a tool?
A: Yes. You must redeploy the application after adding or removing a tool for the new environment variables and tool configurations to take effect.
Q: Why is a tool's description important?
A: The large language model uses a tool's description to decide when to call it. The description should include the tool's function, use cases, and input/output details. Avoid generic descriptions like "a search tool," as the model might fail to select the tool correctly.