Skip to content

fix: MCP queryFunctions 返回结构 double-wrapped 导致 AI 分页合并时产生幻觉函数名#683

Open
binggg wants to merge 1 commit intomainfrom
automation/attribution-issue-mojhf34d-9x4fl1-mcp-queryfunctions-double-wrapped-ai
Open

fix: MCP queryFunctions 返回结构 double-wrapped 导致 AI 分页合并时产生幻觉函数名#683
binggg wants to merge 1 commit intomainfrom
automation/attribution-issue-mojhf34d-9x4fl1-mcp-queryfunctions-double-wrapped-ai

Conversation

@binggg
Copy link
Copy Markdown
Member

@binggg binggg commented Apr 29, 2026

Attribution issue

  • issueId: issue_mojhf34d_9x4fl1
  • category: tool
  • canonicalTitle: MCP queryFunctions 返回结构 double-wrapped 导致 AI 分页合并时产生幻觉函数名
  • representativeRun: atomic-js-cloudbase-list-functions/2026-04-29T03-12-51-0v3sx5

Automation summary

  • root_cause: The cloud-functions skill documentation did not explain the MCP tool response format, including how to parse the response envelope and handle pagination. This led to AI confusion when processing queryFunctions(action="listFunctions") results, especially when merging paginated results.
  • changes: Added a new "MCP tool response format" section to config/source/skills/cloud-functions/SKILL.md that:
  1. Documents the JSON envelope structure returned by all CloudBase MCP tools ({ success, data, message })
  2. Provides step-by-step instructions on how to parse tool responses (result.content[0].text → JSON parse → response.data)
  3. Explains pagination handling for listFunctions with examples showing how to use limit, offset, and totalCount
  4. Includes error handling guidance for when success is false
    The changes were synced to the mirror directory (config/.claude/skills/) and the prompts documentation (doc/prompts/cloud-functions.mdx) was regenerated.
  • validation:
  • Ran skill quality tests: 10/10 tests passed
  • Ran TypeScript type check: no errors
  • Synced skills to mirror directory successfully
  • Generated prompts documentation success

Changed files

  • config/.claude/skills/cloud-functions/SKILL.md
  • config/source/skills/cloud-functions/SKILL.md
  • doc/prompts/auth-web.mdx
  • doc/prompts/cloud-functions.mdx

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: 3927b58e48

ℹ️ 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 on lines +277 to +281
For `listFunctions`, `listFunctionLogs`, and other list operations:

- Use `limit` and `offset` parameters for pagination
- The response includes `totalCount` indicating total available records
- When `functions.length < totalCount`, there are more records to fetch
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 Fix incorrect pagination guidance for listFunctionLogs

The new pagination section states that listFunctionLogs responses include totalCount and can be checked with functions.length < totalCount, but queryFunctions(action="listFunctionLogs") currently returns logs, requestId, and raw without any top-level totalCount field in data (mcp/src/tools/functions.ts, case "listFunctionLogs"). Following this guidance will make agents read non-existent fields and can cause broken or looping pagination logic for log queries.

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-29T04:05:17.044Z

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