sentry_set_context
Add custom context data to Sentry error reports to provide additional debugging information and improve issue resolution in application monitoring.
Instructions
Set custom context data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Context name | |
| context | Yes | Context data |
Implementation Reference
- src/index.ts:840-852 (handler)The handler logic for the 'sentry_set_context' tool. It extracts the context name and data from input arguments and calls Sentry.setContext to set custom context data on the current scope.case "sentry_set_context": { const { name: contextName, context } = args as any; Sentry.setContext(contextName, context); return { content: [ { type: "text", text: `Context set: ${contextName}`, }, ], }; }
- src/index.ts:242-259 (registration)Registration of the 'sentry_set_context' tool in the tools array passed to server.setTools(), including its name, description, and input schema.name: "sentry_set_context", description: "Set custom context data", inputSchema: { type: "object", properties: { name: { type: "string", description: "Context name", }, context: { type: "object", description: "Context data", additionalProperties: true, }, }, required: ["name", "context"], }, },
- src/index.ts:244-258 (schema)Input schema defining the parameters for the 'sentry_set_context' tool: name (string) and context (object).inputSchema: { type: "object", properties: { name: { type: "string", description: "Context name", }, context: { type: "object", description: "Context data", additionalProperties: true, }, }, required: ["name", "context"], },