Skip to content

feat(monitors): Add monitor catalog tools#1057

Draft
dcramer wants to merge 3 commits into
mainfrom
codex/sentry-monitor-tools
Draft

feat(monitors): Add monitor catalog tools#1057
dcramer wants to merge 3 commits into
mainfrom
codex/sentry-monitor-tools

Conversation

@dcramer
Copy link
Copy Markdown
Member

@dcramer dcramer commented Jun 5, 2026

Add catalog-only cron monitor tools so agents can discover monitors and inspect schedule, environment state, recent check-ins, and aggregate stats without expanding the default direct tool surface.

Agent-Facing Monitor Tools

find_monitors supports organization-level monitor discovery with project, environment, owner, query, and limit filters. get_monitor_details bundles monitor metadata, recent check-ins, and stats into one agent-friendly response, using projectSlugOrId when a monitor needs project scoping.

Sentry Endpoint Handling

The API client uses upstream-confirmed monitor list, detail, check-in, and stats routes. Check-ins keep Sentry's statsPeriod/start/end date range params, while stats translate the agent-facing time range to since/until/resolution for StatsMixin.

Catalog-Only Routing

get_sentry_resource can resolve monitor URLs through get_monitor_details, but only when that catalog tool is available. Generated definitions confirm the direct tool surface remains unchanged.

Add catalog-only tools for discovering cron monitors and inspecting monitor details, check-ins, and stats. Wire monitor URLs through get_sentry_resource while preserving the default direct tool surface.

Co-Authored-By: Codex <codex@openai.com>
Use the project read scope for monitor details and only advertise monitor resources when the inspect monitor tool is available. This keeps generated catalog guidance aligned with the exposed tool surface.

Co-Authored-By: Codex <codex@openai.com>
Comment thread packages/mcp-core/src/tools/catalog/get-monitor-details.ts
Comment thread packages/mcp-core/src/tools/catalog/get-monitor-details.ts
Copy link
Copy Markdown

@sentry-warden sentry-warden Bot left a comment

Choose a reason for hiding this comment

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

get_sentry_resource inputSchema always exposes 'monitor' resourceType even in skill contexts where it will always fail

The resourceType enum in get_sentry_resource statically includes "monitor" in the tools/list inputSchema for all skill sessions, but the handler calls assertCatalogToolAvailable(context, "get_monitor_details", ...) which throws a UserInputError whenever get_monitor_details is absent — which is the case for all seer, triage, and preprod sessions. The context-aware description omits monitor in those contexts, but the schema still advertises it as a valid enum value; clients that enumerate enum members to decide valid calls will find a value that always errors in those sessions.

Evidence
  • get_sentry_resource declares skills: ["inspect", "triage", "seer", "preprod"] (get-sentry-resource.ts:510), while get_monitor_details declares skills: ["inspect"] only (get-monitor-details.ts:72).
  • The resourceType z.enum in get-sentry-resource.ts always includes "monitor", and getFilteredInputSchema in availability.ts only removes constraint-bound params, not conditional enum values — so the wire inputSchema always shows "monitor" regardless of active skill.
  • At execution time, the "monitor" switch arm unconditionally calls assertCatalogToolAvailable(context, "get_monitor_details", "Monitor") (get-sentry-resource.ts:735), which throws UserInputError whenever availableToolNames does not contain get_monitor_details.
  • The description function conditionally omits monitor from the examples and resource-ID list when monitorResourcesAvailable is false (get-sentry-resource.ts:514-517), confirming the intent is context-dependent, but the schema is not adjusted to match.

Identified by Warden mcp-audit

Reject monitor detail requests that provide only one side of an absolute time range. This returns a clear local input error instead of forwarding partial start or end parameters to Sentry.

Co-Authored-By: Codex <codex@openai.com>
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.

1 participant