Create a tool.
接口说明
创建一个新的工具,支持创建 MCP、函数调用和技能等多种类型的工具。工具创建后可以被 Agent 调用以扩展其能力。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
agentrun:CreateTool |
create |
*Tool
|
无 | 无 |
请求语法
POST /2025-09-10/agents/tools HTTP/1.1
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| body |
CreateToolInputV2 |
否 |
请求体 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
ToolResult |
工具返回结果 |
示例
正常返回示例
JSON格式
{
"code": "SUCCESS",
"requestId": "F8A0F5F3-0C3E-4C82-9D4F-5E4B6A7C8D9E",
"data": {
"toolId": "tool-abc123",
"toolName": "my-mcp-tool",
"workspaceId": "workspace-xyz789",
"description": "这是一个用于处理文档的 MCP 工具",
"toolType": "MCP",
"createMethod": "MCP_REMOTE",
"protocolSpec": "",
"mcpConfig": {
"sessionAffinity": "MCP_STREAMABLE",
"sessionAffinityConfig": "",
"proxyEnabled": true,
"mcpProxyConfiguration": {
"hooks": [
{
"url": "",
"description": "",
"apiVersion": "",
"enabled": true,
"timeout": 0,
"event": "",
"headers": {
"key": ""
}
}
]
},
"boundConfiguration": {
"boundTools": [
{
"toolName": "my-tool",
"method": "POST",
"path": "/api/v1/tools",
"apis": [
{
"method": "",
"path": ""
}
]
}
]
}
},
"status": "Running",
"statusReason": "",
"executionRoleArn": "acs:ram::123456789:role/AliyunFCDefaultRole",
"artifactType": "Code",
"networkConfiguration": {
"networkMode": "PRIVATE",
"vpcId": "vpc-1234567890abcdef0",
"securityGroupId": "sg-1234567890abcdef0",
"vswitchIds": [
"vsw-sg-1234567890abcdef0"
]
},
"codeConfiguration": {
"zipFile": "UEsDBAoAAAAAANF",
"ossBucketName": "my-agent-code-bucket",
"ossObjectName": "agent-code-v1.0.zip",
"checksum": "1234567890123456789",
"language": "python3.12",
"command": [
""
]
},
"containerConfiguration": {
"image": "registry.cn-hangzhou.aliyuncs.com/my-namespace/agent-runtime:latest",
"imageRegistryType": "ACR",
"acrInstanceId": "cri-xxxxx",
"command": [
"/usr/local/bin/entrypoint.sh"
],
"registryConfig": {
"authConfig": {
"userName": "admin",
"password": "abc***"
},
"certConfig": {
"insecure": false,
"rootCaCertBase64": "cm9vdF9jYV9jZXJ0X2Jhc2U2NA=="
},
"networkConfig": {
"vpcId": "vpc-xxxxxxxxxxxxx",
"vSwitchId": "vsw-xxxxxxxxxxxxx",
"securityGroupId": "sg-xxxxxxxxxxxxx"
}
},
"port": 5000
},
"logConfiguration": {
"project": "agent-runtime-logs",
"logstore": "agent-runtime-logs"
},
"ossMountConfig": {
"mountPoints": [
{
"bucketName": "my-bucket",
"bucketPath": "/my-dir",
"endpoint": "http://oss-cn-shanghai.aliyuncs.com",
"mountDir": "/mnt/dir",
"readOnly": true
}
]
},
"nasConfig": {
"groupId": 100,
"mountPoints": [
{
"enableTLS": true,
"mountDir": "/home/test",
"serverAddr": "***-uni85.cn-hangzhou.nas.com:/"
}
],
"userId": 100
},
"cpu": 0.5,
"memory": 512,
"port": 8080,
"createdAt": "2025-09-10T10:00:00Z",
"updatedAt": "2025-09-10T12:00:00Z",
"credentialName": "my-credential",
"timeout": 300,
"environmentVariables": {
"key": ""
}
}
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。
该文章对您有帮助吗?