Skip to content

fix: callCloudApi MCP 工具的 schema/prompt 未清晰标注 CreateUser 必填参数(EnvId),且参数命名约定不明确导致模型首次调用失败#676

Open
binggg wants to merge 1 commit intomainfrom
automation/attribution-issue-mojd35i1-ptw5mr-callcloudapi-mcp-schema-prompt-createuse-mojfeq95
Open

fix: callCloudApi MCP 工具的 schema/prompt 未清晰标注 CreateUser 必填参数(EnvId),且参数命名约定不明确导致模型首次调用失败#676
binggg wants to merge 1 commit intomainfrom
automation/attribution-issue-mojd35i1-ptw5mr-callcloudapi-mcp-schema-prompt-createuse-mojfeq95

Conversation

@binggg
Copy link
Copy Markdown
Member

@binggg binggg commented Apr 29, 2026

Attribution issue

  • issueId: issue_mojd35i1_ptw5mr
  • category: tool
  • canonicalTitle: callCloudApi MCP 工具的 schema/prompt 未清晰标注 CreateUser 必填参数(EnvId),且参数命名约定不明确导致模型首次调用失败
  • representativeRun: atomic-js-cloudbase-cli-user-create/2026-04-29T01-10-03-cz94u1

Automation summary

  • root_cause: The callCloudApi MCP tool's description and params schema did not clearly communicate three critical conventions: (1) most tcb actions require EnvId as a top-level required parameter, (2) params must be flat key-value pairs (not nested like {"User": {...}}), and (3) parameter names must match the API exactly with correct casing (e.g., Name not UserName, Type not UserType, UserStatus not Status). This caused the model to make its first CreateUser call with missing EnvId, nested User wrapper, and wrong parameter names, which failed.
  • changes: Updated mcp/src/tools/capi.ts — added "重要参数约定" section to the tool description with three explicit rules: (1) most tcb actions require EnvId at params top level, (2) params must be flat (with CreateUser counter-example showing wrong nesting vs correct flat structure), (3) parameter naming must match API exactly with common confusion cases listed (Name not UserName, Type not UserType, UserStatus not Status). Also updated the params field description to include a CreateUser example with correct flat params and proper naming, and added emphasis on flat structure and case sensitivity.
  • vali

Changed files

  • mcp/src/tools/capi.ts

… 必填参数(EnvId),且参数命名约定不 (issue_mojd35i1_ptw5mr)
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 97fa2c18fb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread mcp/src/tools/capi.ts
.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 定义一致(区分大小写)。params 必须是扁平键值对,不要嵌套包装。大多数 tcb Action 需要携带 EnvId如不确定参数结构,请先查官方文档。tcb 示例:`{ \"service\": \"tcb\", \"action\": \"DestroyEnv\", \"params\": { \"EnvId\": \"env-xxx\", \"BypassCheck\": true } }`;创建用户:`{ \"service\": \"tcb\", \"action\": \"CreateUser\", \"params\": { \"EnvId\": \"env-xxx\", \"Name\": \"zhangsan\", \"Phone\": \"13800138000\", \"Email\": \"zhangsan@example.com\", \"Type\": \"internalUser\", \"UserStatus\": \"ACTIVE\" } }`;更新环境别名:`{ \"service\": \"tcb\", \"action\": \"ModifyEnv\", \"params\": { \"EnvId\": \"env-xxx\", \"Alias\": \"demo\" } }`。若你的场景是通过 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.

P1 Badge Remove blanket ban on nested params

The new guidance says params “must be flat key-value pairs” and should not be nested, but this is incorrect for many valid tcb actions and will cause malformed requests when the model follows it. In this repo’s own action index, EditAuthConfig requires nested objects like Mfa/PwdUpdateStrategy, and ListTables accepts nested MongoConnector (see mcp/src/generated/tcb-action-index.ts). With the current wording, callers are pushed to flatten or omit these structures, which can break legitimate API calls.

Useful? React with 👍 / 👎.

@binggg
Copy link
Copy Markdown
Member Author

binggg commented Apr 29, 2026

Attribution post-PR evaluation

  • visibility: internal identifiers, run ids, and private links are intentionally omitted
  • attempt: 1
  • eval_scope: primary_only
  • overall: FAILED
  • summary: at least one planned evaluation case failed
  • updated_at: 2026-04-29T02:24:42.279Z

Cases

  • [FAILED] — primary — evaluation failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant