Skip to content

fix(tools): Find a project by numeric ID in find_projects - #2360

Merged
MathurAditya724 merged 1 commit into
mainfrom
fix/find-projects-numeric-id
Nov 18, 2026
Merged

MathurAditya724 merged 1 commit into
mainfrom
fix/find-projects-numeric-id

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Agents that hold a numeric project ID (from alert rules, events, etc.) had no way to turn it into a project slug through the MCP. find_projects sends query as free text, and Sentry's projects endpoint matches free text only against name and slug. The ID is only matched by an id:<n> token (getsentry/sentry src/sentry/core/endpoints/organization_projects.py:219-230), so find_projects(query="4509062593708032") returned an empty list.

Now an all-digits query (with no cursor) is sent as id:<n> first. If no project has that ID, the tool falls back to the old name/slug search, so a query like 2024 still finds web-2024. The query description now says it takes a numeric project ID.

Nothing breaks: the output schema is unchanged and still returns slugs only. Adding id/name fields would break clients that cached the old closed output schema (#2293).

Closes #2359. Reported in MCP-SERVER-GRR.

via automation evt_905b9c478746fd9deeb853f85ad7441b · Run ID dispatch_5ed2bb04d2df0e73a87d39773cc76cce.

--

View Session [Sentry]

Sentry's projects endpoint matches free-text queries against name and
slug only, so find_projects returned nothing when an agent passed a
numeric project ID. Send a numeric query as `id:<n>` first and fall back
to the name/slug search when no project has that ID.
@vercel

vercel Bot commented Nov 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 18, 2026 9:19am UTC

Request Review

@MathurAditya724 MathurAditya724 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Verified id: query behavior against current Sentry organization_projects.py and tested numeric lookup, free-text fallback, and existing behavior (6 tests pass). No blocking issues found.

@MathurAditya724
MathurAditya724 marked this pull request as ready for review November 18, 2026 18:28
@MathurAditya724
MathurAditya724 requested a review from a team as a code owner November 18, 2026 18:28
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 18, 2026
@MathurAditya724
MathurAditya724 merged commit 8738df7 into main Nov 18, 2026
35 checks passed
@MathurAditya724
MathurAditya724 deleted the fix/find-projects-numeric-id branch November 18, 2026 18:28

This branch was successfully deployed

1 active and 1 inactive deployments
Actions — db0bbabb Deployed Nov 18, 2026 by sentry-junior[bot] via eval #1955
Preview — db0bbabb Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

find_projects can't find a project by its numeric ID

1 participant