Repository navigation
ref(mcp): Port Junior's tool description rules - #2260
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
dcramer
approved these changes
Nov 14, 2026
Member
|
rebase |
Add the description and param rules, enforce 512/256 character limits with a shrink-only param baseline, and trim the shared params, gateway tools, and server instructions. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
Some harnesses do not load server instructions, so tool and param text must stand alone. The org and project slug params carry the org/project notation. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
Rewrite the setup, release, snapshot, and docs tool descriptions to the rules in docs/contributing/adding-tools.md: what the tool does and returns, one sibling-contrast line where it matters, and no examples, hints, or use-case lists. Param descriptions now say what the value is and carry their cross-field rules. Rules the handlers already enforce with UserInputError are no longer repeated in prose. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
Rewrite the search_*, trace, span, profile, replay, agent conversation, dropped events, and dashboard tool descriptions to the rules in docs/contributing/adding-tools.md: what the tool returns in user words, one short sibling-routing line, and no examples, hints, or use-case lists. Move field meaning and cross-field rules onto the params, keep the logs regex syntax on the search_logs query param, and drop prose the handlers already enforce. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
Cut call samples, hints, use-case lists, and field names from the alert rule, metric monitor, cron monitor, and uptime monitor tool descriptions. Each description now says what the tool does and returns, with one line that contrasts cron, uptime, and metric monitors and alert rules. Field gotchas moved onto the params they describe, such as condition result codes, percent thresholds, and Slack and Teams destinations. Prose that repeated handler validation is gone. Schemas and behavior are unchanged. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
Cut legacy steering (examples, hints, use-case and DO NOT USE lists) from the issue, event, and resource tool descriptions. Keep what the model needs: what each tool returns, one sibling contrast where tools look alike, search syntax on the query params, and cross-field rules on the dependent param. Drop prose the handlers already enforce or that the responses already carry. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
Every tool and param fits the limits after the rewrite, so the checks are hard limits. search_logs overrides its query description at the use site instead of through a one-off builder option. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
sentry-junior
Bot
force-pushed
the
feat/mcp-tool-description-rules
branch
from
November 16, 2026 17:18
7acf91e to
4131ee1
Compare
Contributor
Author
|
Rebased onto main ( |
dcramer
added a commit
that referenced
this pull request
Nov 16, 2026
Follow-ups from #2260, which removed description text that carried behavior the handlers did not enforce. **403 on Alert and Metric Monitor writes** (`create_alert_rule`, `update_alert_rule`, `create_metric_monitor`, `update_metric_monitor`) Today a denied write returns `API error (403): You do not have permission to perform this action.` followed by "you may be able to resolve this by trying again". `withAlertWritePermissionHint` wraps only the write call and adds what Sentry checks to a bare 403: - Alerts need `alerts:write` and permission to edit alerts in every connected project. An Alert that uses the all-projects source also needs `org:write`. - Metric Monitors need `alerts:write` in their project. The message also says that retrying with the same token will not help: reconnect with those scopes, or ask an org Owner or Manager. The error stays an `ApiPermissionError`, so it remains an expected 4xx with its status. A 403 that names its missing scopes is unchanged, and `formatErrorForUser` still reports it as **Missing Permission**. These 403s are bare because of how the Sentry endpoints check permissions. The workflow and detector endpoints let `org:read` tokens through to object-level checks (`enforce_workflow_edit_permissions`, `enforce_detector_workflow_connection_permissions`, `can_edit_detector` in `workflow_engine/endpoints/validators/utils.py`). `enforce_scope` sends an `insufficient_scope` challenge only to Seer agent tokens. There is no `org:write` pre-check for all-project sources. The server can't see the token's effective scopes (token scopes combined with the member's role), so a pre-check would cost an extra API call and could guess wrong. The 403 guidance covers that case instead. **Other tools** - `create_project` adds a `guidance` field. It tells the agent to give the user the project slug and DSN, points to `create_dsn` when no DSN was set up, and says when the repository did not link. - `get_profile` adds optional `guidance` when there is no data: check the exact transaction name with `search_traces`, try a longer period, or confirm profiling is enabled. In comparison mode it names the period with no profiles. - `onboarding_status_update` rejects `status: "failed"` without `eventNote`. Nothing breaks. `guidance` is additive in both output schemas. The new `eventNote` rule rejects only input that the description already called invalid. <!-- junior-request-attribution:start --> via @dcramer. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC08J1NSPU6S%3A1794851244.179419 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC08J1NSPU6S%3A1794851244.179419) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC08J1NSPU6S%3A1794851244.179419/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: David Cramer <23610+dcramer@users.noreply.github.com>
7 tasks done
This branch was successfully 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.
Tool descriptions still followed legacy steering:
<examples>call samples,<hints>, "Use this tool when you need to:" lists,DO NOT USEblocks, and org/project hints copied into every tool. This ports the rules from Junior'spolicies/tool-design.mdandagent-steering.mdand rewrites every MCP tool to match.Rules (
docs/contributing/adding-tools.md, "Descriptions and Params")describe()on the param, and cross-field rules go on the dependent field. A tool description never names its input fields.get_sentry_resourceas the starting point for URLs and IDs). The server instructions may repeat it.UserInputErroror a query rewrite) is deleted.tool-descriptions.test.tsenforces these as hard limits: 512 characters per tool description (down from 2,048) and 256 per param, including nested params. It also rejects<examples>/<hints>and fails when a description names its own input fields.Tool descriptions went from 67.6k to 17.8k characters, and param descriptions from 70.7k to 44.0k. Total tool definition tokens went from about 76.7k to 59.8k; most of what remains is output schemas. The change is text only: no schemas, defaults, validation, or handler output changed.
Follow-ups. This text carried behavior that the handlers don't enforce yet, so it belongs in code:
create_project: add a response note when the repository fails to link, and one that tells the user the DSN.onboarding_status_update:failedrequireseventNote, but only the param text says so. Enforce it with asuperRefine.update_alert_rule/update_metric_monitor: add a 403 hint for a missingalerts:writescope.org:write. Nothing checks this before the API call.get_profile: add an empty-result response note (exact transaction name, longer period, profiling enabled).via @dcramer.
--
View Session [Sentry]