get_sift_analysis
Retrieve a specific analysis from a Grafana investigation using its unique UUID to access detailed monitoring insights and incident data.
Instructions
Retrieves a specific analysis from an investigation by its UUID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| analysisId | Yes | The UUID of the specific analysis | |
| investigationId | Yes | The UUID of the investigation |
Implementation Reference
- src/tools/sift.ts:112-124 (handler)The async handler function that executes the tool logic: creates a Sift API client and fetches the specific analysis data.handler: async (params, context: ToolContext) => { try { const client = createSiftClient(context.config.grafanaConfig); const response = await client.get( `/api/v1/investigations/${params.investigationId}/analyses/${params.analysisId}` ); return createToolResult(response.data); } catch (error: any) { return createErrorResult(error.response?.data?.message || error.message); } },
- src/tools/sift.ts:14-17 (schema)Zod schema defining the input parameters for the tool: investigationId and analysisId.const GetSiftAnalysisSchema = z.object({ investigationId: z.string().describe('The UUID of the investigation'), analysisId: z.string().describe('The UUID of the specific analysis'), });
- src/tools/sift.ts:215-221 (registration)Registration function for Sift tools, including the server.registerTool(getSiftAnalysis) call for this tool.export function registerSiftTools(server: any) { server.registerTool(listSiftInvestigations); server.registerTool(getSiftInvestigation); server.registerTool(getSiftAnalysis); server.registerTool(findSlowRequests); server.registerTool(findErrorPatternLogs); }
- src/tools/sift.ts:34-57 (helper)Helper function to create an axios client configured for the Sift API, used in the tool handler.function createSiftClient(config: any) { const headers: any = { 'User-Agent': 'mcp-grafana/1.0.0', 'Content-Type': 'application/json', }; if (config.serviceAccountToken) { headers['Authorization'] = `Bearer ${config.serviceAccountToken}`; } else if (config.apiKey) { headers['Authorization'] = `Bearer ${config.apiKey}`; } // Sift uses a different base URL pattern const baseUrl = config.url.replace(/\/$/, ''); const siftUrl = baseUrl.includes('grafana.net') ? baseUrl.replace('grafana.net', 'sift.grafana.net') : `${baseUrl}/api/plugins/grafana-sift-app/resources`; return axios.create({ baseURL: siftUrl, headers, timeout: 60000, // Longer timeout for investigations }); }