Skip to main content
Glama
0xteamhq

Grafana MCP Server

by 0xteamhq

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
NameRequiredDescriptionDefault
analysisIdYesThe UUID of the specific analysis
investigationIdYesThe UUID of the investigation

Implementation Reference

  • 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); } },
  • 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'), });
  • 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); }
  • 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 }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/0xteamhq/mcp-grafana'

If you have feedback or need assistance with the MCP directory API, please join our Discord server