Skip to content

ref(mcp): Call shared uptime monitor endpoints - #1840

Merged
BYK merged 1 commit into
ref/shared-monitor-endpointsfrom
ref/shared-uptime-monitor-endpoints
Nov 3, 2026
Merged

BYK merged 1 commit into
ref/shared-monitor-endpointsfrom
ref/shared-uptime-monitor-endpoints

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Task 8.4 of the shared API client plan (#1669). This is stacked on #1839.

This moves the uptime monitor endpoints from SentryApiService into toolkit-core's api-client/endpoints/uptime-monitors. SentryApiService calls them with its Zod schemas. The code moves as is.

  • listUptimeMonitors takes a numeric projectId, since the endpoint filters by ID. SentryApiService still looks the project slug up first.
  • getUptimeMonitor and listUptimeMonitorChecks. The checks list still defaults to 24 hours unless a range is given, through defaultStatsPeriod from ref(mcp): Call shared cron monitor endpoints and time range helpers #1839.
  • createUptimeMonitor and updateUptimeMonitor share one field list, so the body still holds every field that is set (an explicit null included), in the same order as before.
  • deleteUptimeMonitor still counts a 404 as already deleted.

@sentry/api has no uptime operations at all, so these wrappers stay hand-written.

One change in behaviour: as with #1741, a response that fails its schema now throws the shared ApiResponseValidationError instead of a ZodError.

Checked with pnpm run tsc, pnpm run lint, pnpm run docs:check, and the toolkit-core, mcp-core, mcp-server bundle, and mcp-cloudflare tests (run on the top of the stack, the replay branch at 73bfc0b3, before the later rebases), plus the uptime tool tests on this commit.

via @BYK.

--

View Session [Sentry]

@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
sentry-local Ready Ready Preview Nov 3, 2026 11:16am UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 3, 2026
@sentry-junior
sentry-junior Bot force-pushed the ref/shared-uptime-monitor-endpoints branch from 1e9eeca to 4ee2a0a Compare November 3, 2026 10:34
@sentry-junior
sentry-junior Bot force-pushed the ref/shared-uptime-monitor-endpoints branch from 4ee2a0a to 3d7ccb8 Compare November 3, 2026 10:47
Moves the uptime monitor endpoints (list, details, checks, create,
update, delete) from SentryApiService into toolkit-core's shared API
client, as is. SentryApiService keeps the project slug to ID lookup for
the list filter and calls the wrappers with its Zod schemas.

Co-Authored-By: Burak Yigit Kaya <126780+BYK@users.noreply.github.com>
@sentry-junior
sentry-junior Bot force-pushed the ref/shared-uptime-monitor-endpoints branch from 3d7ccb8 to 359222f Compare November 3, 2026 11:14
@BYK
BYK added this pull request to stack #1851 November 3, 2026 12:12
@BYK
BYK merged commit fff2676 into main Nov 3, 2026
66 of 69 checks passed
@BYK
BYK deleted the ref/shared-uptime-monitor-endpoints branch November 3, 2026 12:13
BYK added a commit that referenced this pull request Nov 3, 2026
Task 8.4 of the shared API client plan
([#1669](#1669)). This is
stacked on #1840.

This moves the trace, profiling, and preprod snapshot endpoints from
`SentryApiService` into `toolkit-core`'s `api-client/endpoints/`.
`SentryApiService` calls them with its Zod schemas. The code moves as
is.

- `endpoints/traces`: `getTraceMeta` and `getTrace`, with the same
defaults (`14d`, `limit=1000`, `project=-1`).
- `endpoints/profiling`: `getFlamegraph` (still escapes the transaction
name), `getTransactionProfile`, and `getProfileChunks`.
`SentryApiService.getProfileChunk` keeps the MCP-only shaping: it throws
`ApiNotFoundError` when there are no chunks and backfills `profiler_id`.
- `endpoints/snapshots`: `getSnapshot`, `getSnapshotImage`, and
`getLatestBaseSnapshot`. They return the body unvalidated, as before.
`fetchImageByUrl` stays in `SentryApiService`, since it isn't an
endpoint.

`@sentry/api` has operations for all of these routes. The wrappers still
build their requests by hand so the change stays a move. Switching them
to the operations can follow.

**Intentional changes:**

- As with #1741, a response that fails its schema now throws the shared
`ApiResponseValidationError` instead of a `ZodError`.
- `getSnapshot` with `compactMetadata: false` no longer sends a trailing
`?` with an empty query.
- The `ApiNotFoundError` for an empty chunk list carries the validated
body as `responseBody`, not the raw one.

Checked with `pnpm run tsc`, `pnpm run lint`, `pnpm run docs:check`, and
the toolkit-core, mcp-core, mcp-server bundle, and mcp-cloudflare tests
on the top of the stack, plus the trace, profile, and snapshot tool
tests on this commit.

<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3Ab061171f2ec2e6cf6f09a6828cadc9fa -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3Ab061171f2ec2e6cf6f09a6828cadc9fa)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Ab061171f2ec2e6cf6f09a6828cadc9fa/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Burak Yigit Kaya <126780+BYK@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
Preview — 359222f4 Deployed Nov 3, 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.

1 participant