Skip to content

feat(tools): add update_dsn tool for managing DSN client key settings#1099

Merged
dcramer merged 5 commits into
getsentry:mainfrom
ajith-nataraj:feat/update-dsn-tool
Jun 17, 2026
Merged

feat(tools): add update_dsn tool for managing DSN client key settings#1099
dcramer merged 5 commits into
getsentry:mainfrom
ajith-nataraj:feat/update-dsn-tool

Conversation

@ajith-nataraj

Copy link
Copy Markdown
Contributor

Summary

Adds a new update_dsn MCP tool that enables AI assistants to update Sentry DSN (client key) configuration for a project. This fills a gap where DSN keys could be read via get_dsn_details but not modified.

Key Changes

  • New update_dsn tool: Allows updating rate limits, browser SDK version, and dynamic SDK loader options on a Sentry client key
  • Extended ClientKeySchema: Added rateLimit, browserSdkVersion, and dynamicSdkLoaderOptions fields to support the full PUT response shape
  • New updateClientKey API method: PUT request to /projects/:org/:project/keys/:keyId/ endpoint
  • MSW mock handler: Added PUT mock for the client key endpoint for test coverage
  • Comprehensive tests: Covers success cases (rate limit, SDK version, loader options, combined updates) and input validation errors

Capabilities

The tool accepts the following update parameters (all optional, at least one required):

  • rateLimitCount + rateLimitWindow: Set per-DSN rate limits (or pass 0 to clear)
  • browserSdkVersion: Pin a specific Sentry Browser SDK version
  • dynamicSdkLoaderOptions: Toggle performance monitoring, session replay, and debug mode on the CDN loader

Breaking Changes

  • None

Add a new MCP tool that allows AI assistants to update Sentry DSN (client
key) configuration including rate limits, browser SDK version, and dynamic
SDK loader options.

### Key Changes
- Added `update_dsn` tool with support for:
  - Rate limiting (count + window in seconds)
  - Browser SDK version selection
  - Dynamic SDK loader feature toggles (performance, replay, debug)
- Extended `ClientKeySchema` in schema.ts with rateLimit, browserSdkVersion,
  and dynamicSdkLoaderOptions fields
- Added `updateClientKey` API method to client.ts (PUT /projects/:org/:project/keys/:id/)
- Added MSW mock handler for PUT requests to client key endpoint
- Registered tool in catalog index and generated updated tool definitions
- Added comprehensive tests covering success cases and input validation

Co-Authored-By: Antigravity (Google DeepMind) <noreply@google.com>
Comment thread packages/mcp-core/src/tools/catalog/update-dsn.ts
Without this guard, calling the tool with only organizationSlug,
projectSlug, and keyId would issue a PUT with an empty body, silently
performing a no-op while returning a success response.

Addresses Cursor Bugbot review feedback on getsentry#1099.

Co-Authored-By: Antigravity (Google DeepMind) <noreply@google.com>
Align update_dsn with the core ProjectKey update contract after verifying the upstream Sentry endpoint and serializers. Preserve flexible browser SDK versions while matching rate-limit bounds and zero-value behavior.

Add server-level catalog dispatch coverage so the catalog-only tool is exercised through execute_sentry_tool, and document the safe QA path for mutating catalog-only tools.

Co-Authored-By: GPT-5 Codex <codex@openai.com>
Comment thread packages/mcp-core/src/tools/catalog/update-dsn.ts
@dcramer

dcramer commented Jun 17, 2026

Copy link
Copy Markdown
Member

Will get this cleaned up and merged thank you!

Map zero-valued update_dsn rate-limit input to rateLimit: null so the request and response both represent a disabled DSN limit.

Update handler and catalog-dispatch tests to cover the disabled output.

Co-Authored-By: GPT-5 Codex <codex@openai.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c750cd6. Configure here.

Comment thread packages/mcp-core/src/tools/catalog/update-dsn.ts
Render zero-valued DSN rate limit responses as disabled so the tool does not report an active cap of zero events. Add coverage for an API response that returns a zero-valued rate limit object.\n\nCo-Authored-By: GPT-5 Codex <codex@openai.com>
@dcramer dcramer merged commit 554d1d5 into getsentry:main Jun 17, 2026
11 checks passed
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.

2 participants