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