Skip to content

fix(get_canister_candid): carry the interface text in the structured output - #229

Merged
aterga merged 3 commits into
mainfrom
fix/candid-text-in-structured-output
Nov 3, 2026
Merged

aterga merged 3 commits into
mainfrom
fix/candid-text-in-structured-output

Conversation

@sea-snake

Copy link
Copy Markdown
Collaborator

Clients that read structuredContent (Claude Code among them) show the model only that object and drop the text blocks. Since #222 the structured output of get_canister_candid described the interface (bytes, methods, flags) without carrying it, so those clients never received the .did text.

This adds the candid field back to GetCandidOutput. Replies are kept to 5 KB, so carrying the text in both places stays small.

🤖 Generated with Claude Code

…output

Clients that read structuredContent (Claude Code among them) drop the text
blocks, so since #222 they received the interface's size and flags but never
the .did itself. Add the `candid` field back to GetCandidOutput.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sea-snake
sea-snake requested review from a team and a balanced review from Copilot November 3, 2026 16:08
aterga
aterga previously approved these changes Nov 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The schema change conflicts with an existing test assertion, while duplicated, unbounded Candid output risks oversized responses and client truncation.

2 open issues
What changed in this PR

Restores Candid interface text in get_canister_candid structured output so clients that ignore text blocks can still read the interface.

Changes:

  • Adds candid to the output type and populates it with the rendered interface.
  • Updates unit and end-to-end reply assertions to expect structured interface text.
  • Revises tool descriptions and documentation to describe both output locations.
File Description
README.md Documents the structured candid field.
crates/​imcp2-core/​src/​tools.rs Populates candid and updates tool descriptions and reply assertions.
crates/​imcp2-core/​src/​e2e_canister_tools.rs Checks that structured output includes the full interface.
crates/​imcp2-core/​src/​calls.rs Adds the public candid output field and its documentation.

Review effort: Balanced

Comment thread crates/imcp2-core/src/calls.rs Resolved
Comment thread crates/imcp2-core/src/tools.rs Resolved
Copilot AI balanced review requested due to automatic review settings November 3, 2026 16:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Unconditionally duplicating renderings that can bypass the 5 KB limit can produce oversized responses and reintroduce client truncation.

2 open issues

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 3, 2026 16:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the change restoring Candid interface text in structured output.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@aterga
aterga merged commit f0f098c into main Nov 3, 2026
17 checks passed
@aterga aterga mentioned this pull request Nov 19, 2026
6 of 8 tasks
@raymondk raymondk mentioned this pull request Nov 19, 2026
6 of 8 tasks
aterga pushed a commit that referenced this pull request Nov 19, 2026
* Bump crates to 0.7.0

All three crates share one version. A minor bump: since 0.6.1 the server
gained the deploy tools (bundle host, upload store, pipeline, MCP tools,
remote serving and metrics, #261, #265, #266), the cap on the MCP request
body behind the bearer gate (#241), vetted-connector branding surfaced to
Internet Identity (#200), and get_canister_candid now carries the interface
text in its structured output (#229).

The rc-0.7.0 candidate needs this on main first: deploy-candidate.yml and
publish-crate.yml both refuse a tag whose version disagrees with every
Cargo.toml.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VP2vTGJNrpdaVxN1aY8XSX

* Deploy tools: say per server how to hand icp_deploy the bundle again

#266 rewrote the icp_deploy description and hard-coded its step (2) as
"upload that bundle via icp_deploy_upload". The local server does not list
that tool: it takes the bundle as `bundle_path`. The sentence that
IcDeployTools::tools() put in per server was anchored on text the rewrite
removed, so it silently stopped being put in, and
a_server_lists_the_bundle_argument_it_takes has failed on main since.

Step (2) is now the anchor. The description says "hand that bundle to this
tool", and each server replaces that with its own way in: upload via
`icp_deploy_upload` on a server with an upload store, the bundle's absolute
path as `bundle_path` on one without. The hosted server's text is what #266
wrote, with the tool name in backticks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VP2vTGJNrpdaVxN1aY8XSX

* README: depend on imcp2 0.7

`imcp2 = "0.6"` matches 0.6.x only, and the README ships in the crate, so a
reader of 0.7.0's page would be told to depend on the release before it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VP2vTGJNrpdaVxN1aY8XSX

* Deploy tools: keep the description's step (2) as written

Review asked for the description's text back. The tool's description in
the source says step (2) as #266 wrote it, "upload that bundle via
icp_deploy_upload", and the hosted server lists it unchanged. Only a
server without an upload store, imcp2-local, puts "pass that bundle's
absolute path as `bundle_path`" in its place, since it lists no
icp_deploy_upload.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VP2vTGJNrpdaVxN1aY8XSX

---------

Co-authored-by: Claude <[email protected]>
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.

3 participants