sentry_get_organization_stats
Retrieve organization statistics from Sentry to monitor error volumes, track rejected events, and analyze blacklisted data over specified time periods.
Instructions
Get organization statistics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stat | Yes | Type of statistic | |
| since | No | Start date (ISO format or timestamp) | |
| until | No | End date (ISO format or timestamp) | |
| resolution | No | Time resolution |
Implementation Reference
- src/index.ts:456-483 (schema)Tool schema definition in the ListTools response, including input schema with parameters: stat (required, enum: received/rejected/blacklisted), optional since/until dates, and resolution (10s/1h/1d).{ name: "sentry_get_organization_stats", description: "Get organization statistics", inputSchema: { type: "object", properties: { stat: { type: "string", enum: ["received", "rejected", "blacklisted"], description: "Type of statistic", }, since: { type: "string", description: "Start date (ISO format or timestamp)", }, until: { type: "string", description: "End date (ISO format or timestamp)", }, resolution: { type: "string", enum: ["10s", "1h", "1d"], description: "Time resolution", }, }, required: ["stat"], }, },
- src/index.ts:1081-1101 (handler)MCP tool handler in the CallToolRequestHandler switch statement. Validates API client, extracts input parameters, calls SentryAPIClient.getOrganizationStats, and returns the stats as a formatted text response.case "sentry_get_organization_stats": { if (!apiClient) { throw new Error("Sentry API client not initialized. Provide auth token."); } const { stat, since, until, resolution } = args as any; const stats = await apiClient.getOrganizationStats(stat, { since, until, resolution, }); return { content: [ { type: "text", text: `Organization ${stat} stats:\n${JSON.stringify(stats, null, 2)}`, }, ], }; }
- src/sentry-api-client.ts:134-137 (helper)Helper method in SentryAPIClient class that constructs the Sentry API endpoint for organization stats (/organizations/{org}/stats/{stat}/) with query params and performs the authenticated HTTP GET request.async getOrganizationStats(stat: string, params?: any) { const queryParams = params ? '?' + new URLSearchParams(params).toString() : ''; return this.request(`/organizations/${this.org}/stats/${stat}/${queryParams}`); }