跳到主内容

MCP工具参考

列出工具

调用tools/list以发现工具:

POST /api/mcp
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}

响应取决于身份验证:未通过身份验证的请求可查看所有工具(用于发现);会话身份验证返回完整列表;作用域令牌仅返回该令牌作用域所允许的工具。

服务器返回带有输入模式的工具定义:

{
"jsonrpc": "2.0",
"id": 2,
"result": {
"tools": [
{
"name": "get_applications",
"description": "Get all applications for a specific owner",
"inputSchema": {
"type": "object",
"properties": {
"owner": {
"type": "string",
"description": "The owner of applications"
}
},
"required": ["owner"]
}
}
]
}
}

应用管理工具

MCP 服务器目前提供以下应用管理工具:

get_applications - 获取组织的所有应用:

{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "get_applications",
"arguments": {
"owner": "my-org"
}
}
}

get_application - 获取特定应用的详细信息:

{
"jsonrpc": "2.0",
"id": 4,
"method": "tools/call",
"params": {
"name": "get_application",
"arguments": {
"id": "my-org/my-app"
}
}
}

add_application - 创建新应用:

{
"jsonrpc": "2.0",
"id": 5,
"method": "tools/call",
"params": {
"name": "add_application",
"arguments": {
"application": {
"owner": "my-org",
"name": "new-app",
"displayName": "New Application",
"organization": "my-org"
}
}
}
}

update_application - 修改现有应用:

{
"jsonrpc": "2.0",
"id": 6,
"method": "tools/call",
"params": {
"name": "update_application",
"arguments": {
"id": "my-org/my-app",
"application": {
"owner": "my-org",
"name": "my-app",
"displayName": "Updated Name"
}
}
}
}

delete_application - 删除应用:

{
"jsonrpc": "2.0",
"id": 7,
"method": "tools/call",
"params": {
"name": "delete_application",
"arguments": {
"application": {
"owner": "my-org",
"name": "old-app"
}
}
}
}

User Management Tools

The MCP server also provides user management tools, mirroring the application tools:

  • get_users — List all users in an organization (argument: owner).
  • get_user — Get one user by id, or by owner + email, or owner + phone.
  • add_user — Create a user (argument: user object).
  • update_user — Modify an existing user (arguments: id and user object).
  • delete_user — Delete a user (argument: user object).

They are called the same way as the application tools — via tools/call with the tool name and arguments. As with the other tools, results are subject to the caller's auth and scopes.

响应格式

工具调用以结构化格式返回结果:

{
"jsonrpc": "2.0",
"id": 3,
"result": {
"content": [
{
"type": "text",
"text": "[{\"name\":\"app1\",\"displayName\":\"App 1\"}]"
}
]
}
}

当工具执行过程中出现错误时,响应中会包含一个isError标志:

{
"jsonrpc": "2.0",
"id": 5,
"result": {
"content": [
{
"type": "text",
"text": "application quota is exceeded"
}
],
"isError": true
}
}