Skip to content

fix(platform): tell the model which wrapper a tool argument goes in - #1106

Open
Walternater wants to merge 2 commits into
Tencent:mainfrom
Walternater:fix/platform-tool-argument-wrapper
Open

Walternater wants to merge 2 commits into
Tencent:mainfrom
Walternater:fix/platform-tool-argument-wrapper

Conversation

@Walternater

Copy link
Copy Markdown

What changed

Read-only platform tools described their arguments as Query: projectId while the input schema accepts only path/query/body at the top level (additionalProperties: false). The model followed the description, passed a top-level projectId, and got unknown field on its first call before retrying with the wrapped shape. #1084 shows two such failures out of twelve in one 13-second span.

Closes #1084:

  • docs/api/openapi.yaml — GET /api/workflows now declares projectId and q. The handler (internal/httpapi/catalog.go:1012) already read both; the contract omitted them, so ToolInputSchema emitted an empty query object and the model had to guess.
  • internal/httpapi/agent_tool_catalog.go — descriptions now end with the wrapper objects the schema actually accepts, e.g. Arguments go inside query, for example {"query": {...}}., for read-only and write tools alike. Only wrappers that can carry a field are named: an empty query or an absent body is left out, so a no-argument tool grows no hint.

Scope

  • Platform — web / API (tool catalog and its OpenAPI contract)

Verification

  • go test ./internal/httpapi/ ./internal/mcpserver/ ./docs/api/ -count=1 → all pass (httpapi 229s, full package).
    • New: TestPlatformToolArgumentHintNamesTheWrapper (query for GET, body for PUT, path for path-parameterised tools, no body on a GET), TestPlatformToolArgumentHintIsEmptyWithoutWrappers (a tool with no arguments gets no hint — this case caught the first version, which named the always-present empty query).
    • The existing TestOpenAPICoversEveryPublicOperation guards the contract edit.
  • npm --prefix chatbot test (built via scripts/build-chatbot.sh) → 401 tests, 56 files pass.
  • Not run: smoke-install.sh / e2e.sh locally; this change does not touch install or runtime paths, and CI runs them.

Note on wording

The hint is English because it appends to the English op.Description. The draft-protocol prompt already tells the model to wrap arguments by body/path/query (assistant.go:1083); this makes the per-tool description say the same thing where the model reads it at call time.

🤖 Generated with Claude Code

Walternater and others added 2 commits November 19, 2026 19:57
The validate and release-local workflows never installed ripgrep, and
validate.sh reads a missing rg (exit 127) as "no match" inside if-rg,
so every forbidden-content scan skipped silently while the job printed
"Validation passed." (issue Tencent#1044).

- validate.sh now fails loudly when rg is not on PATH.
- Both workflows install ripgrep before running validate.sh.

Merge after Tencent#909: apt ships rg 15.1.0 on resolute (ubuntu-latest) and
14.1.0 on noble; with rg present, 15.x glob handling self-matches
scripts/validate.sh in scan 1 (the known bug Tencent#909 fixes, noble
unaffected). Until Tencent#909 merges, validate (3.12) shows that known
failure on this branch.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Read-only tools described their arguments as "Query: projectId" while
their input schema accepts only path/query/body at the top level, so the
model passed a top-level projectId and got "unknown field" on its first
call, then retried with the right shape (issue Tencent#1084).

- /api/workflows GET now declares its projectId and q query parameters;
  the handler already read them but the contract omitted them, so the
  generated schema had an empty query object.
- Tool descriptions now name the wrapper objects the schema actually
  accepts and show one example, for read-only and write tools alike.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 只读平台工具的描述写 "Query: projectId",但 schema 要求包进 query 对象,首次调用必然失败

1 participant