Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mcp/src/tools/capi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ export function registerCapiTools(server: ExtendedMcpServer) {
**云函数**: \`DescribeFunctions\`、\`CreateFunction\`、\`UpdateFunctionCode\`、\`DeleteFunction\`
**数据库**: \`CreateMySQLInstance\`、\`DescribeMySQLInstances\`、\`DestroyMySQLInstance\`

销毁环境时,常见做法是至少带上 \`EnvId\` 和 \`BypassCheck: true\`,如果环境已经处于隔离期再按文档补 \`IsForce: true\`。`,
销毁环境时,常见做法是至少带上 \`EnvId\` 和 \`BypassCheck: true\`,如果环境已经处于隔离期再按文档补 \`IsForce: true\`。

**重要提示:** 几乎所有 tcb Action 都要求 \`EnvId\` 为顶层必填参数(如 \`CreateUser\`、\`ModifyUser\`、\`DescribeUserList\` 等)。调用前须先通过 auth 工具获取 \`current_env_id\`,并在 params 顶层传入 \`"EnvId": "<envId>"\`。参数须为扁平键值对,与官方 API 定义一致,不要嵌套包裹。例如创建用户:\`{ "EnvId": "env-xxx", "Name": "zhangsan", "Phone": "13800138000", "Type": "internalUser", "UserStatus": "ACTIVE" }\`(注意字段名为 \`Name\` 而非 \`UserName\`,\`Type\` 而非 \`UserType\`,\`UserStatus\` 而非 \`Status\`)。`,
inputSchema: {
service: z
.enum(ALLOWED_SERVICES)
Expand All @@ -204,7 +206,7 @@ export function registerCapiTools(server: ExtendedMcpServer) {
.record(z.any())
.optional()
.describe(
"Action 对应的参数对象,键名需与官方 API 定义一致。某些 Action 需要携带 EnvId 等信息;如不确定参数结构,请先查官方文档。tcb 示例:`{ \"service\": \"tcb\", \"action\": \"DestroyEnv\", \"params\": { \"EnvId\": \"env-xxx\", \"BypassCheck\": true } }`,如果环境已经处于隔离期,可再补 `IsForce: true`;更新环境别名则可用 `{ \"service\": \"tcb\", \"action\": \"ModifyEnv\", \"params\": { \"EnvId\": \"env-xxx\", \"Alias\": \"demo\" } }`。若你的场景是通过 HTTP 协议直接集成 auth/functions/cloudrun/storage/mysqldb 等 CloudBase 业务 API,请优先使用 OpenAPI / Swagger 或 searchKnowledgeBase(mode=\"openapi\"),而不是优先使用 callCloudApi。",
"Action 对应的参数对象,键名为扁平键值对(与官方 API 定义一致,不要嵌套包裹)。几乎所有 tcb Action 都要求顶层传入 `EnvId`(可通过 auth 工具获取 `current_env_id`);如不确定参数结构,请先查官方文档。tcb 示例:`{ \"service\": \"tcb\", \"action\": \"DestroyEnv\", \"params\": { \"EnvId\": \"env-xxx\", \"BypassCheck\": true } }`,如果环境已经处于隔离期,可再补 `IsForce: true`;创建用户:`{ \"service\": \"tcb\", \"action\": \"CreateUser\", \"params\": { \"EnvId\": \"env-xxx\", \"Name\": \"zhangsan\", \"Phone\": \"13800138000\", \"Type\": \"internalUser\", \"UserStatus\": \"ACTIVE\" } }`。注意 CreateUser 的必填字段是 `EnvId` 和 `Name`(不是 `UserName`),用户类型字段是 `Type`(不是 `UserType`),状态字段是 `UserStatus`(不是 `Status`)。若你的场景是通过 HTTP 协议直接集成 auth/functions/cloudrun/storage/mysqldb 等 CloudBase 业务 API,请优先使用 OpenAPI / Swagger 或 searchKnowledgeBase(mode=\"openapi\"),而不是优先使用 callCloudApi。",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Relax blanket flat-params guidance for callCloudApi

The updated params prompt now says parameters must be flat key/value pairs and “do not nest,” but several supported actions legitimately require nested objects, so this wording can drive agents to send invalid payloads. For example, CreateTable includes nested MongoConnector/PermissionInfo structures in mcp/src/generated/tcb-action-index.ts; if callers follow this new instruction literally, those fields may be omitted or flattened incorrectly and the action will fail. Please scope the rule to avoiding an extra wrapper object (like User: {...}) rather than forbidding API-defined nested fields.

Useful? React with 👍 / 👎.

),
},
annotations: {
Expand Down
Loading