Repository navigation
fix(code-mode): prefer snake case mcp tool annotations fields over camel case ones - #373
Merged
Merged
Conversation
MTEnt
marked this pull request as ready for review
August 20, 2026 08:00
MTEnt
requested review from
bhaveshpatel640,
chiragjn,
debajyoti-truefoundry,
heerambavi1998,
sr07asthana and
thesujai
as code owners
August 20, 2026 08:00
chiragjn
reviewed
Aug 26, 2026
chiragjn
reviewed
Aug 26, 2026
chiragjn
reviewed
Aug 26, 2026
chiragjn
reviewed
Aug 26, 2026
chiragjn
reviewed
Aug 26, 2026
chiragjn
reviewed
Aug 26, 2026
chiragjn
reviewed
Aug 26, 2026
chiragjn
requested changes
Aug 26, 2026
chiragjn
left a comment
Member
There was a problem hiding this comment.
This is forward compatibility PR to support mcp 2.0 sdk. Please do not change any behavior around detecting destructive tools in this PR
🦋 Changeset detectedLatest commit: 32f9c86 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
chiragjn
approved these changes
Aug 26, 2026
chiragjn
force-pushed
the
fix/code-mode-destructive-gate
branch
from
August 26, 2026 12:36
04154d1 to
32f9c86
Compare
chiragjn
enabled auto-merge (squash)
August 26, 2026 12:36
2 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses the MCP Python SDK 2.0 compatibility portion of #318.
MCP Python SDK 1.29 exposes tool annotation attributes in camelCase, while SDK 2.0 exposes them in snake_case. This change prefers the SDK 2.0 snake_case fields and falls back to the older camelCase fields. Existing destructive-tool behavior, including the handling of unannotated tools, is unchanged.
Changes
destructive_hintandread_only_hintin the core sandbox client, with camelCase fallback.@truefoundry/trueforge-coreand@truefoundry/trueforge.How was this tested?
mcp==1.29.0andmcp==2.0.0model objects through both_is_destructiveimplementations, covering unannotated, read-only, destructive, and non-read-only non-destructive tools.pnpm typecheckusing Git Bash as the package script shell on Windows.pnpm format:check.pnpm lint:ciwas run but reports 23 errors in unchanged frontend files on this Windows checkout; the full local-check item below is therefore left unchecked.Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locallypackages/trueforge-sdk,.github/fern/openapi/openapi.json,docs/openapi.json) - fork PRs omit SDK regen; maintainers regenerate after merge.env.exampleupdated if configuration or behavior changed - not applicableNote
Low Risk
Narrow compatibility change in annotation field lookup only; destructive-tool gating logic and approval behavior are explicitly preserved.
Overview
Updates Code Mode MCP client destructive-tool checks to work with MCP Python SDK 2.0, which exposes tool annotation fields as
destructive_hintandread_only_hintinstead of the SDK 1.29 camelCase names.In
mcp_client.py,_is_destructivenow reads those hints viagetattr, preferring snake_case and falling back todestructiveHint/readOnlyHint. The local UDS clientmcp_client_local.pyapplies the same preference on annotation dict keys. When a tool is blocked in Code Mode is unchanged (including unannotated tools and the read-only / destructive rules).Patch changesets were added for
@truefoundry/trueforge-coreand@truefoundry/trueforge.Reviewed by Cursor Bugbot for commit 32f9c86. Bugbot is set up for automated code reviews on this repo. Configure here.