Skip to content

fix: MCP 工具参数校验错误提示过于模糊,无法定位问题#664

Open
binggg wants to merge 1 commit intomainfrom
automation/attribution-issue-mo8wixix-yg65qg-mcp
Open

fix: MCP 工具参数校验错误提示过于模糊,无法定位问题#664
binggg wants to merge 1 commit intomainfrom
automation/attribution-issue-mo8wixix-yg65qg-mcp

Conversation

@binggg
Copy link
Copy Markdown
Member

@binggg binggg commented Apr 28, 2026

Attribution issue

  • issueId: issue_mo8wixix_yg65qg
  • category: tool
  • canonicalTitle: MCP 工具参数校验错误提示过于模糊,无法定位问题
  • representativeRun: atomic-js-cloudbase-call-http/2026-04-21T17-31-53-uwanxk

Automation summary

**

  • root_cause: The error message "400 invalid parameter value" from CloudBase API was not being handled by the existing error patterns in capi.ts or functions.ts. This resulted in vague error messages that didn't help users identify which parameter was wrong or how to fix it.
  • changes:
  1. mcp/src/tools/capi.ts: Added hasInvalidParameterValueError regex pattern and corresponding handling in buildCapiErrorMessage() to detect "invalid parameter value" errors. When detected, the tool now provides specific guidance about:
  • Checking string parameters for empty values or illegal characters
  • Verifying numeric parameters are within valid ranges
  • Ensuring enum values use correct case-sensitive values
  • Confirming required parameters have values
  • Showing parameter type reference when available for tcb actions
  1. mcp/src/tools/functions.ts: Added handling for "invalid parameter value" errors in buildFunctionOperationErrorMessage() with specific guidance for function deployment:
  • runtime: Supported versions (Nodejs18.15, Nodejs16.13, Nodejs20.19) with case sensitivity note
  • handler: Default values for Event vs HTTP functions
  • functionName: Valid charact

Changed files

  • mcp/src/tools/capi.ts
  • mcp/src/tools/functions.ts

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: f2cf768cf3

ℹ️ 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
const tcbEntry = service === "tcb" ? findTcbActionEntry(action) : undefined;
const hasInvalidActionError = /invalid or not found|does not exist|not recognized/i.test(baseMessage);
const hasParameterError = /parameter\s+`?.+?`?\s+is not recognized|MissingParameter|missing parameter|missing required/i.test(baseMessage);
const hasInvalidParameterValueError = /invalid parameter value/i.test(baseMessage);
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 Match InvalidParameterValue error code variant

The new detector only matches the spaced phrase invalid parameter value, but CloudBase control-plane responses commonly use the TCAPI code token InvalidParameterValue (see the x-tcapi-errorcodes lists in mcp/assets/control-plane/tcb-openapi.yaml, e.g. around lines 2411-2418). In that common case this branch will never run, so the newly added targeted guidance is skipped and users still get the generic fallback message.

Useful? React with 👍 / 👎.

@binggg
Copy link
Copy Markdown
Member Author

binggg commented Apr 28, 2026

Attribution post-PR evaluation

  • visibility: internal identifiers, run ids, and private links are intentionally omitted
  • attempt: 1
  • eval_scope: primary_only
  • overall: PASSED
  • summary: all planned evaluation cases passed
  • updated_at: 2026-04-28T22:55:06.138Z

Cases

  • [PASSED] — primary — evaluation passed

@binggg
Copy link
Copy Markdown
Member Author

binggg commented Apr 29, 2026

参考codex 代码 review结论

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