ListMcpTools - 查询 MCP 工具列表
查询指定 MCP 服务公开的工具列表及其输入输出 Schema。
接口说明
请求说明
查询指定 MCP 服务公开的工具列表及其输入输出 Schema。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求语法
GET /workspaces/{workspaceId}/mcp-servers/{mcpServerId}/tools HTTP/1.1
路径参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| workspaceId |
string |
是 |
AgentCore 工作空间 ID |
workspace-id |
| mcpServerId |
string |
是 |
MCP 服务 ID |
mcp-server-id |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| maxResults |
integer |
否 |
单次返回的最大结果数,默认值为 10,最大值为 100 |
6 |
| nextToken |
string |
否 |
分页令牌 |
2 |
调用“查询 MCP 工具列表”接口时,请按参数定义传入:AgentCore 工作空间 ID、MCP 服务 ID、单次返回的最大结果数,默认值为 10,最大值为 100、分页令牌。
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
查询成功 |
||
| requestId |
string |
请求 ID。 |
A1B2C3D4-E5F6-47A8-90AB-CDEF12345678 |
| message |
string |
响应消息。 |
请求处理成功 |
| httpStatusCode |
integer |
HTTP 状态码。 |
200 |
| code |
string |
业务状态码。 |
Success |
| success |
boolean |
请求是否成功。 |
|
| items |
array<object> |
列表数据。 |
|
|
object |
|||
| toolName |
string |
MCP 工具名称 |
get-current-time |
| toolDescription |
string |
MCP 工具描述 |
Get the current time |
| inputSchema |
string |
工具输入参数 Schema。 |
{"type":"object"} |
| outputSchema |
string |
工具输出参数 Schema。 |
{"type":"object"} |
| totalCount |
integer |
总记录数。 |
100 |
| maxResults |
integer |
每页最大返回条数。 |
20 |
| nextToken |
string |
下一页令牌。 |
next-page-token |
“查询 MCP 工具列表”接口的响应包含:请求 ID、响应消息、HTTP 状态码、业务状态码、请求是否成功、列表数据 等信息。
示例
正常返回示例
JSON格式
{
"requestId": "A1B2C3D4-E5F6-47A8-90AB-CDEF12345678",
"message": "请求处理成功",
"httpStatusCode": 200,
"code": "Success",
"success": true,
"items": [
{
"toolName": "get-current-time",
"toolDescription": "Get the current time",
"inputSchema": "{\"type\":\"object\"}",
"outputSchema": "{\"type\":\"object\"}"
}
],
"totalCount": 100,
"maxResults": 20,
"nextToken": "next-page-token"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidParameter | Parameter error: %s. | 参数错误 |
| 400 | IllegalRequest | Illegal request: %s. | 非法请求 |
| 400 | InvalidParameter.ImportFileSize | The import file size exceeds the allowed limit: %s. | 导入文件大小超过限制 |
| 500 | InternalError | The MCP server data could not be processed. | |
| 403 | NoPermission | You are not authorized to perform this operation: %s. | 无操作权限 |
| 502 | McpServerToolsQueryFailed | Failed to query tools of the specified MCP server. | |
| 404 | Resource.NotFound | Not found: %s. | |
| 404 | NotFound | Not found: %s. | 指定的工作空间、资源 或 版本不存在 |
| 409 | McpServerToolsUnavailable | The tools of the specified MCP server are currently unavailable. | |
| 409 | ResourceAlreadyExist | Resource already exists: %s. | 指定的资源已存在 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。