sentry_setup_project
Configure Sentry error monitoring for a project by generating a DSN and providing platform-specific setup instructions.
Instructions
Set up Sentry for a project returning a DSN and instructions for setup.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectSlug | Yes | Project slug/identifier | |
| platform | No | Platform for installation instructions | javascript |
Implementation Reference
- src/index.ts:1304-1376 (handler)Handler function for the 'sentry_setup_project' tool. Retrieves or creates a Sentry project key to obtain the DSN and generates platform-specific installation instructions.case "sentry_setup_project": { if (!apiClient) { throw new Error("Sentry API client not initialized. Provide auth token."); } const { projectSlug, platform = "javascript" } = args as any; // Get project keys (DSN) const keys = await apiClient.listProjectKeys(projectSlug); let dsn = ''; if (keys.length > 0) { dsn = keys[0].dsn.public; } else { // Create a new key if none exists const newKey = await apiClient.createProjectKey(projectSlug, 'Default'); dsn = newKey.dsn.public; } // Installation instructions based on platform const instructions: { [key: string]: string } = { javascript: `// Install Sentry npm install --save @sentry/browser // Initialize Sentry import * as Sentry from "@sentry/browser"; Sentry.init({ dsn: "${dsn}", integrations: [ Sentry.browserTracingIntegration(), Sentry.replayIntegration(), ], tracesSampleRate: 1.0, replaysSessionSampleRate: 0.1, replaysOnErrorSampleRate: 1.0, });`, node: `// Install Sentry npm install --save @sentry/node // Initialize Sentry const Sentry = require("@sentry/node"); Sentry.init({ dsn: "${dsn}", tracesSampleRate: 1.0, });`, python: `# Install Sentry pip install --upgrade sentry-sdk # Initialize Sentry import sentry_sdk sentry_sdk.init( dsn="${dsn}", traces_sample_rate=1.0, profiles_sample_rate=1.0, )`, }; return { content: [ { type: "text", text: `Sentry setup for project ${projectSlug}:\n\n` + `DSN: ${dsn}\n\n` + `Installation instructions for ${platform}:\n\n` + (instructions[platform] || instructions.javascript), }, ], }; }
- src/index.ts:652-670 (registration)Registration of the 'sentry_setup_project' tool including name, description, and input schema definition.{ name: "sentry_setup_project", description: "Set up Sentry for a project returning a DSN and instructions for setup.", inputSchema: { type: "object", properties: { projectSlug: { type: "string", description: "Project slug/identifier", }, platform: { type: "string", description: "Platform for installation instructions", default: "javascript", }, }, required: ["projectSlug"], }, },
- src/index.ts:655-669 (schema)Input schema definition for the 'sentry_setup_project' tool.inputSchema: { type: "object", properties: { projectSlug: { type: "string", description: "Project slug/identifier", }, platform: { type: "string", description: "Platform for installation instructions", default: "javascript", }, }, required: ["projectSlug"], },