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
      });
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states a read operation ('retrieves'), which implies safety, but doesn't cover critical aspects like authentication requirements, rate limits, error handling, or what happens if IDs are invalid. This leaves significant gaps for a tool that accesses sensitive investigation data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every part of the sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations and no output schema, the description is incomplete. It doesn't explain what an 'analysis' contains, the return format, or behavioral traits like data sensitivity. Given the context (investigation data access), more detail is needed to help an agent use it correctly and safely.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters clearly documented in the schema. The description adds no additional semantic context beyond implying UUIDs are used for identification. This meets the baseline of 3 since the schema does the heavy lifting, but the description doesn't enhance understanding (e.g., explaining relationship between investigation and analysis IDs).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('retrieves') and resource ('a specific analysis from an investigation'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_sift_investigation' or 'list_sift_investigations', which would require mentioning it fetches a single analysis rather than a list or investigation details.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing investigation and analysis), exclusions, or comparisons to siblings like 'list_sift_investigations' for browsing analyses. Usage is implied but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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