sentry_get_organization_stats
Extract detailed organization statistics for monitoring error handling, including received, rejected, and blacklisted data, over specified time intervals with customizable resolution, for effective application health analysis.
Instructions
Get organization statistics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resolution | No | Time resolution | |
| since | No | Start date (ISO format or timestamp) | |
| stat | Yes | Type of statistic | |
| until | No | End date (ISO format or timestamp) |
Implementation Reference
- src/index.ts:1081-1101 (handler)Handler for the sentry_get_organization_stats tool. Extracts input parameters, checks for API client, fetches stats via API client, and returns 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/index.ts:459-482 (schema)Input schema defining parameters for the sentry_get_organization_stats tool, including required 'stat' and optional date range and resolution.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:456-483 (registration)Tool registration entry in the ListTools response, specifying name, description, and input schema.{ 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/sentry-api-client.ts:134-137 (helper)Helper method in SentryAPIClient that constructs and sends the HTTP request to the Sentry organization stats endpoint.async getOrganizationStats(stat: string, params?: any) { const queryParams = params ? '?' + new URLSearchParams(params).toString() : ''; return this.request(`/organizations/${this.org}/stats/${stat}/${queryParams}`); }