This document guides you through creating, debugging, and using custom plugins to integrate the APIs you need.
Workflow
- Createa plugin: Define the plugin's basic information.
- Add a tool: Configure the specific API path, request parameters, and response data for the plugin.
- Debug and publish: Test the API connectivity online and publish the tool after confirming it works as expected.
- Use in an application: Associate the plugin with an agent and call it through conversational testing or API integration.
Create a custom plugin
Create a custom plugin
Step 1: Create a plugin
-
Go to the Plugins page and click Create Plugin.
-
Enter the plugin information.
Plug-in Name: Enter a descriptive name. Chinese and English are supported.
Example: Dormitory Agreement Query Tool Test
Plug-in Description: Briefly describe the plugin's features and purpose in natural language. This description helps the model decide when to use the plugin.
Example: Queries the content of a specific dormitory agreement entry based on the input numeric index.
Plug-in URL: The access endpoint of the plugin.
Example:https://domitorgreement-plugin-example-icohrkdjxy.cn-beijing.fcapp.run
-
Model Studio treats different paths under the same domain as different APIs. These paths correspond to the Tool Path you configure when creating a tool.
-
Tools within the same plugin share a domain name, but each tool's path maps to a unique API.
For example, a plugin contains two APIs:
Query: https://xxx.com/query
Delete: https://xxx.com/delete
In this example,
https://xxx.comis the Plug-in URL, while/queryand/deleteare the Tool Path values. This indicates that the plugin contains two tools.
If authentication is required, enable the Enable Authentication switch and enter the authentication settings.
Authentication parameters
Headers (Optional)
If authentication is required, you can pass authentication information in a custom header.
Enable Authentication (Optional)
Determines whether an application must provide authentication to call your custom plugin. This depends on your API provider's security policy.
Authentication Type
There are two authentication methods: service-level authentication and user-level authentication.
Location: You can place the authentication information in the request header or query string.
Header: This option places the authentication information in the
Authorizationheader of the HTTP request, keeping it hidden from the URL.Query: This option places the authentication information in the URL. For example:
https://example.com?api_key=123456.
Parameter Name: If you place the authentication information in the query string, specify the parameter name used for authentication, such as
api_key. If you place it in the header, the parameter isAuthorizationby default.Type:
basic: Does not add any prefix to the token you provide.
bearer: Adds the
Bearerprefix to the token.appcode: Adds the
APPCODEprefix to the token.
The prefix is included in the authentication field. For example, if you select
bearer, theAuthorizationheader becomesAuthorization: Bearer <YOUR_TOKEN>.Token (for service-level authentication): The authentication token from the API provider, such as an API key.
-
-
After completing the form, click Confirm Create Plug-inCreate Tool or click Continue to Add Tool.
Step 2: Create a tool
-
Enter the tool information, configure input and output parameters, and define any advanced settings.
In this example, enter "Dormitory Rules Query Tool" for Tool Name and "Queries the content of a specific dormitory rule based on the input numeric index" for Tool Description. Set the Tool Path to
/article, select POST for the Request Method, and select application/json for the Submission Method. For the input parameter, set the parameter name toarticle_index, the parameter description to "index", and the type to Number. This parameter is passed in the Body, is required, and its passing method is LLM recognition. For the output parameter, set the parameter name toarticle, the parameter description to "dormitory rule content", and the type to String. In the advanced settings, the user input query is "Query the content of the corresponding dormitory rule based on the input index value", and the value of thearticle_indexinput parameter is5. -
After completing the configuration, click Save Draft.
-
Debug the tool online to verify that the API is callable.
Click Test Tool. If you enabled authentication, enter the authentication information and input parameter values. Then, click Start Running.
If the run fails, adjust the configuration based on the error message in the Run Result section and test again until the run succeeds.
You can enter input parameter values manually or as code. For complex parameters, use Code Editing. In the code editor, you can submit the complete JSON-formatted input parameters and their corresponding values.
-
After the test passes, click Publish. Applications can only call tools that are Published.
Use a plugin
Console
-
Method 1: Publish the plugin as an MCP service, and then add the service to an agent application.
Step 1: Publish the plugin as an MCP service-
On the Plugins page, hover over the target plugin card and click Publish as MCP Service.
If the plugin has already been converted to an MCP service, the button changes to View MCP Service. Click it to go to the MCP Management page and view the service details.
-
After successful publication, you can view the details of the MCP service on the MCP Management page, including the service name, description, and ID.
-
Go to the orchestration canvas of the Agent Application application. In the MCP block, click +.
-
In the Select MCP Service panel, switch to the Custom MCPS tab, find the MCP service converted from the plugin, and click Add All to add it to the application.
You can also click Convert from Plugin to MCP to directly publish a plugin that has not yet been converted.
-
Test whether the plugin works as expected.
- No authentication: Chat with the model in the input box to test the plugin's functionality.
user-level authenticationorservice-level authentication: Before you start a conversation, click
to configure the authentication token. You only need to configure the token once per session on this page.- If the Passing Method for a tool's input parameter is set to Business Pass-through, you must click
to configure the variable value before you start a conversation. You only need to enter the value once per session on this page.
-
After completing the test, Publish the application.
-
-
Method 2: On the Application Management page, go to the orchestration canvas for your Agent Application application, add the MCP service from the MCP block, test its functionality, and then Publish the application.
API
Get the tool IDThe tool ID identifies a specific tool. When you call a tool via an API, you must pass the correct tool ID to ensure the system correctly identifies the request.
- In the Plugins list, find the plugin that contains the tool and click View Details.
- Hover the pointer over the
icon next to the tool name. - Click the
icon to copy the tool ID.
- When you call an application by using an API, if the application's plugin uses
business pass-throughparameters or requires User-level Authentication, you must use thebiz_paramsparameter to pass the authentication information or pass-through parameter information. For more information, see DashScope API Reference for Workflows and Legacy Agent Applications.
Manage plugins and tools
Delete a plugin
ImportantDeleting a plugin also deletes all its tools, causing any applications that call the plugin to fail. This action is irreversible.
In the Plugins list, find the target plugin and click ... > Delete.
Edit a plugin
-
In the Plugins list, find the target plugin and click View Details.
-
In the upper-right corner, click Modify Plug-in, modify the plugin information, and save the changes.
Changes take effect immediately. If you modify the plugin URL, headers, or authentication information, tool calls might fail. You must test and publish the tools again.
Edit a tool
After you modify a tool, you must test and publish it again for the changes to take effect.
- In the Plugins list, find the plugin that contains the tool and click View Details.
- In the row that contains the tool, click Modify, modify the tool information, and then click Save Draft.
- Click Test Tool to debug the tool online.
- After the run succeeds, click Publish.
Delete a tool
ImportantDeleting a tool causes any applications that call it to fail. This action is irreversible.
- In the Plugins list, find the plugin that contains the tool and click View Details.
- In the row that contains the tool, click Delete.
Error codes
The following table describes common error messages that can occur when you publish a tool.
Error code | Error message | Description |
|---|---|---|
130040 | The parameter description for xx is missing. | Cause: The description for the Solution: Add the parameter description and publish the tool again. |
130022 | Failed to save the tool information. Check whether the sample parameters are correct. | Possible cause 1: An input or output parameter of the Solution: Click the Possible cause 2: The request method is GET, but an input parameter is of the Solution: GET requests do not support the |
icon at the end of the object's row to add a sub-property.