Skip to content

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

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

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

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

符号链接删除是之前就存在的,与我的更改无关。唯一修改的文件是 mcp/src/tools/capi.ts。 总结: - 根本原因callCloudApi 工具的描述模糊地写着“某些 Action 需要携带 EnvId”(某些操作需要 EnvId),这太弱了——几乎所有 tcb 操作都需要 EnvId 作为顶级必需参数。代理调用 CreateUser 时没有包含 EnvId,使用了错误的参数名(UserName 而不是 NameUserType 而不是 TypeStatus 而不是 UserStatus),并将参数嵌套在 User 对象中,而不是以扁平结构传递。该工具没有提供 CreateUser 的示例,也没有澄清参数命名约定。 - 更改:更新了 mcp/src/tools/capi.tscallCloudApi 工具的描述和 params 字段描述,以: 1. 明确指出几乎所有 tcb 操作都需要 EnvId 作为顶级参数(而不是模糊的“某些”) 2. 指导用户从 auth 工具的 current_env_id 获取 EnvId 3. 说明参数必须是扁平键值对(没有嵌套封装) 4. 添加一个 CreateUser 示例,展示正确的扁平参数结构 5. 明确澄清常见的命名混淆:Name(不是 UserName),Type(不是 UserType),UserStatus(不是 Status) - 验证:TypeScript 编译干净,所有 3 个必选技能质量测试通过(10/10 测试),diff 中没有评估工件泄露。 - 后续行动:无。这是一项真正的产品缺陷——工具描述不足导致模型在首次尝试时使用 callCloudApi 时失败。

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: 755d8aebff

ℹ️ 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 定义一致,不要嵌套包裹)。几乎所有 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 👍 / 👎.

@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-29T01:45:09.193Z

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