Repository navigation
feat: return raw MCP results from workspace MCP tools - #31385
Conversation
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
546e39b to
a152555
Compare
|
@codex security review |
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
a152555 to
76bfe6b
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
76bfe6b to
03826a8
Compare
03826a8 to
ffaa784
Compare
ffaa784 to
b5a25ad
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
{ \n \n\n---\nAutomated review via Coder Agents. Reply to a finding's thread with the reason if the finding is wrong.\n\n\n"Findings for agents\n\nyaml\n- id: audience-1\n persona: audience\n class: rule\n blocking: true\n file: docs/coder-agents/extending-agents.md\n line: 465\n quote: \"An outdated workspace agent drops embedded resources, such as PDFs, from tool results.\"\n evidence:\n - agent/x/agentmcp/manager.go:1071-1075 (convertResult replaces EmbeddedResource with placeholder text)\n rule: docs/.style/content-guidelines.md#describe-the-current-version-for-the-end-user\n problem: The sentence frames a version-dependent behavior without telling the reader what to do about it, describing an outdated agent's behavior instead of the observable effect the reader can act on.\n fix: Reframe to the effect and the action, for example: \"An outdated workspace agent replaces embedded resources, such as PDFs, with a placeholder text, so the model does not receive the file. Update the workspace agent to deliver them.\"\n verified: true\n\n- id: consistency-1\n persona: consistency\n class: suggestion\n blocking: false\n file: docs/coder-agents/extending-agents.md\n line: 463\n quote: \"A tool result can include an image or a PDF, and the model receives it as a file.\"\n evidence:\n - docs/coder-agents/platform-controls/mcp-servers.md:188 (verbatim identical)\n - docs/coder-agents/platform-controls/mcp-servers.md:189 (verbatim identical)\n rule: null\n problem: This sentence repeats the same sentence verbatim from the \"Tool results\" section of mcp-servers.md instead of linking to it, so the two copies can drift.\n fix: Link to the existing section instead of repeating it, for example: \"For how tool results can carry images and PDFs, and the provider and size rules, refer to [Tool results](./platform-controls/mcp-servers.md#tool-results).\"\n verified: true\n\n- id: consistency-2\n persona: consistency\n class: suggestion\n blocking: false\n file: docs/coder-agents/extending-agents.md\n line: 465\n quote: \"An outdated workspace agent drops embedded resources, such as PDFs, from tool results.\"\n evidence:\n - docs/coder-agents/extending-agents.md:463-464 (calls the same content \"an image or a PDF\" / \"a file\")\n rule: docs/.style/style-guide/word-choice.md#one-term-per-concept\n problem: \"embedded resources\" is a new name for the same tool-result content the page already calls \"an image or a PDF\" / \"a file\", so the concept has two names and the reader may wonder whether they differ.\n fix: Use one name for the concept, for example: \"An outdated workspace agent drops embedded files, such as PDFs, from tool results.\"\n verified: true\n\n- id: learner-1\n persona: learner\n class: suggestion\n blocking: false\n file: docs/coder-agents/extending-agents.md\n line: 463\n quote: \"A tool result can include an image or a PDF, and the model receives it as a file.\"\n evidence:\n - coderd/x/chatd/mcpclient/mcpclient.go:1479-1489 (ConvertCallResult appends StructuredContent as JSON text)\n rule: null\n problem: The section teaches only images and PDFs, so a reader does not learn that structured content in a workspace MCP tool result is also delivered to the model, not dropped.\n fix: Add a line noting that structured content is delivered to the model as text as well, alongside the existing image/PDF guidance.\n verified: true\n\n\n} |
Workspace MCP tools will reuse the remote MCP result converter, so export it and drop the test-only alias.
When a call-tool request sets include_result, the agent returns the MCP CallToolResult in MCP wire format in Result and leaves Content empty. Embedded resources and structured content then reach coderd. Requests without the flag get the legacy Content response.
…lient Workspace MCP tools now ask the agent for the raw MCP result and convert it with mcpclient.ConvertCallResult, the converter remote MCP tools use, so PDFs, embedded resources and structured content are kept. Responses from older agents carry only legacy Content, which is adapted to MCP content values and passed to the same converter.
The revive flag-parameter rule rejects a bool parameter that switches convertResult between two outputs. CallTool now picks rawResult or convertResult, and convertResult keeps its original signature.
… tool results Workspace MCP tool results now keep embedded resources, so an image or a PDF from a .mcp.json server reaches the model as a file. Older agents still drop embedded resources.
b5a25ad to
2eef4d2
Compare
…d section Link to the shared Tool results section instead of repeating its rules.
… tool result cap (#31386) Part of [CODAGT-1430](https://linear.app/codercom/issue/CODAGT-1430). Stacked on #31385. Inline and in-process MCP servers cap each tool result at 256 KiB, and media counts at its base64 size, so a PDF over about 190 KiB becomes an error. In-process servers are our own code running in coderd, so we'll count only their text toward the cap, and leave their media to the 10 MiB tool media cap in chatloop. Inline servers are untrusted, so they still count base64 media.
…ment The doc-check agent posted the raw JSON of its review request as the summary comment on #31385. Tell the agent to write the summary to its own Markdown file, give it the exact post and edit commands, and check that the comment starts with the summary heading when it reads it back.
…ment The doc-check agent posted the raw JSON of its review request as the summary comment on #31385. Tell the agent to write the summary to its own Markdown file, give it the exact post and edit commands, and check that the comment starts with the summary heading when it reads it back.
…ment (#31994) The doc-check agent posted the raw JSON of its review request as the summary comment on #31385 ([comment](#31385 (comment))), so GitHub showed `{"commit_id": ..., "event": "COMMENT", "body": "## Documentation Check\n..."}` with escaped newlines. The inline review on that run posted correctly. Of the latest summary comments on 42 PRs reviewed since 2026-10-25, this is the only malformed one. This changes `.claude/skills/doc-check/output.md` so the agent: - writes the review request to `review.json` and leaves the review `body` empty, which matches what every other run does; - writes the summary to its own `summary.md`, never reuses `review.json` for it, and posts or edits it with exact `gh api ... -F body=@summary.md` commands; - checks, when it reads the comment back, that the body starts with `## Documentation Check` and ends with the marker, and fixes it with `PATCH` if not. ### Follow-up: workflow guard (not in this PR yet) A workflow job that fails the run when the sticky summary comment does not start with `## Documentation Check` is ready, but the bot that opened this PR can't push changes under `.github/workflows/`. The patch adds a `check-summary-comment` job (`needs: doc-check`, `pull-requests: read`) at the end of `doc-check.yaml`, after `delete-workspace`, so it stays clear of the hunks #31720 changes. It passed `actionlint` (with shellcheck) and `zizmor --offline` with no findings, and a dry run against live comments failed on #31385 and passed on #31896 and #31934. Related open PRs: #31649 (draft) also edits `output.md`, and #31720 edits `doc-check.yaml`. Whichever lands second may need a small rebase. Supersedes #31966, reopened under a human author for attribution. Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
Part of CODAGT-1430. Stacked on #31384.
Workspace MCP tool results go through the agent's
convertResult, which turns an embedded resource into a[embedded resource: ...]string and drops structured content, so a PDF from a workspace MCP server never reaches the model. Remote MCP tools already go throughmcpclient's converter, which keeps both.When a call-tool request sets
include_result, the agent now returns the MCPCallToolResultas-is inResultand leavesContentempty. chattool always sets it and converts the result withmcpclient.ConvertCallResult, so workspace and remote MCP tools share one converter. Older agents ignore the flag and send the legacyContent, which we adapt to MCP content and pass to the same converter. The workspace MCP docs get a short Tool results section too.