feat: generate Layer-1 MCP tool docs from toolRegistry / Zod schemas
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- json, markdown, typescript
- Domain
- api, documentation, tooling
Research direction
Start from the @tool registrations in src/api and the registry path used by e2e/scripts/generate-mcp-types.ts, then check how src/mcp/mcp.middleware.ts converts Zod schemas with zodToJsonSchema. Decide the output layout (checked-in docs/api/mcp/ versus CI artifact) with maintainers first. Done means npm run generate:mcp-docs emits an index and per-tool pages covering every registered tool, and CI flags stale output.
Written by the indexing model from the issue text.
Description
Summary
Cocos CLI exposes a large MCP tool surface (@tool + Zod in src/api), but there is no machine-generated API/tool documentation. Humans and agents currently have to reverse-engineer schemas from source (and some critical fields like OpenPaaS accessToken are easy to miss because they are optional / not on a dedicated openpaas branch).
We previously mapped the CLI into four layers:
- Tools (MCP) —
src/api@toolregistry → what agents actually call - Commands —
src/commands/ CLI entry - Lib facade —
src/lib - Core —
src/core(+ scene-process RPC)
This issue is specifically about Layer 1: ship a documentation generator (not a one-off markdown dump) that keeps docs in sync with code.
Motivation
- Existing
docs/is hand-written Markdown only — no TypeDoc / API site pipeline. - We already reverse-generate types/schemas for machines (
generate:mcp-types,zodToJsonSchemainMcpMiddleware,generate:dts,typescript-json-schema), but nothing produces human-readable tool docs from the same source of truth. - PinK / agent users hit gaps such as: OpenPaaS build requiring
packages.*.accessTokenwhile schema marks it optional andplatform=openpaasfalls into the catch-all option branch.
Proposal
Add a maintainable generator, e.g.:
- Script:
workflow/generate-mcp-tool-docs.ts(or undere2e/scripts/) - npm script:
generate:mcp-docs - Input: runtime
toolRegistry(same path asgenerate:mcp-types) + Zod → JSON Schema (zodToJsonSchema, Gemini-flat style preferred) - Output (checked in or CI artifact):
docs/api/mcp/README.md— index by category + tool countdocs/api/mcp/<category>/<tool>.md— title, description, params, result schema, source file pointer- optional
docs/api/mcp/tools.jsonfor tooling
Phase 2 (out of scope for first PR, but leave hooks): generate docs for Commands / Lib / Core layers the same way.
Acceptance criteria
-
npm run generate:mcp-docsregenerates Layer-1 docs from current@toolregistrations - CI fails (or warns) if generated docs are stale vs source
- Every registered tool has name / title / description / inputSchema / outputSchema documented
- Generated docs call out platform-specific
packages.*fields (including OpenPaaS-related optional fields) - CONTRIBUTING.md documents when to run the generator
Related existing machinery
e2e/scripts/generate-mcp-types.ts— registry → TS typessrc/mcp/mcp.middleware.ts—zodToJsonSchemafortools/listworkflow/generate-dts.ts/workflow/generate-schema.js— types/config schema only, not docs
Non-goals (for this issue)
- Full TypeDoc website for all of
src/core - Changing MCP runtime behavior
- Hand-writing the entire tool catalog once without a regenerator
- Dominant language
- TypeScript
- Stars
- 450
- Forks
- 158
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 33
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cocos/cocos-cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
cocos/cocos-cli#1016 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 57/100
Maintainers usually reply within 1 day
-
cocos-cli 无法通过ts 的编译Open
Difficulty 3/5 1-2 days Newbie friendliness 54/100
cocos/cocos-cli#1017 · 1 comment ·
Maintainers usually reply within 1 day
-
bug P2
Difficulty 3/5 1-2 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
Pink game app launches with overlapping screen fontsMay be free again @tangkaikk claimed this 38 days ago, and no pull request is open. Openbug P2
cocos/cocos-cli#959 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
e2e-failure ready-to-code
Difficulty 1/5 Under an hour Newbie friendliness 82/100
redhat-developer/rhdh-plugin-export-overlays#4616 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
ai-handle
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nextlevelbuilder/dewee-web-v2#73 ·
Maintainers usually reply within 1 day
-
backend bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
PoCInnovation/Distribox#255 ·
Maintainers usually reply within 1 day