Use the MCP tool title as approval copy without destructiveHint - #2102
Open
Abhishek-B-R wants to merge 1 commit into
Open
Abhishek-B-R wants to merge 1 commit into
Abhishek-B-R wants to merge 1 commit into
Conversation
This branch has not been deployed
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
An MCP tool's
titleannotation only became itsapprovalDescriptionwhen the tool also declareddestructiveHint: true. So a truthfully additive tool gated by arequire_approvalpolicy showedApprove <address>? (matched policy: <pattern>)instead of its title, and the only way to get a readable prompt was to mark the tool destructive.This takes option 1 from the issue: the title is used as
approvalDescriptionwhenever it is present, in bothtoToolDef(the stored tool row) andresolveAnnotations(whatenforceApprovalreads at invoke time).requiresApprovalis still decided bydestructiveHintalone, a destructive tool without a title still falls back to its tool name, and an untitled non-destructive tool keeps the address and policy prompt.One visible difference: for a titled non-destructive tool the prompt no longer includes the matched policy pattern, same as titled destructive tools today. The arguments preview is still appended.
Linked issue
Closes #2074
Verification
Added a
create_titledtool (destructiveHint: false,title: "Create dataset") to the annotations test server and two cases inplugin.test.ts:requiresApproval: falseandapprovalDescription: "Create dataset"; an untitled destructive tool still reads its name, and an unannotated tool has no descriptionrequire_approvalpolicy on the integration, invoking the additive tool elicits a prompt that starts with "Create dataset"Both fail on
main(the second shows theApprove tools.annotations_test...prompt from the issue) and pass here.oxfmt --checkon the changed files: cleanoxlint -c .oxlintrc.jsonc --deny-warnings packages/plugins/mcpandbun run lint:changelog-stubs: cleantsgo --noEmitinpackages/plugins/mcp: exit 0vitest runinpackages/plugins/mcp: 312 passed, 29 skipped (39 files)Checklist
bun run changeset), or this change needs none.