Skip to main content
Glama
DrDroidLab

Grafana MCP Server

grafana_fetch_datasources

Retrieve all configured data sources and their settings from Grafana to manage connections and monitor data integrations.

Instructions

Fetches all datasources from Grafana with their configuration details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core implementation that makes the HTTP request to the Grafana API to fetch datasources.
    def grafana_fetch_datasources(self) -> dict[str, Any]:
        """
        Fetches all datasources from Grafana.
    
        Returns:
            Dict containing list of datasources
        """
        try:
            url = f"{self.__host}/api/datasources"
            logger.info("Fetching all datasources")
    
            response = requests.get(url, headers=self.headers, verify=self.__ssl_verify, timeout=20)
    
            if response.status_code == 200:
  • The wrapper function in the MCP server that interfaces with the processor to call the tool.
    def grafana_fetch_datasources():
        """Fetch all datasources from Grafana"""
        try:
            grafana_processor = current_app.config.get("grafana_processor")
            if not grafana_processor:
                return {
                    "status": "error",
                    "message": "Grafana processor not initialized. Check configuration.",
                }
    
            result = grafana_processor.grafana_fetch_datasources()
            return result
        except Exception as e:
            logger.error(f"Error fetching datasources: {e!s}")
            return {"status": "error", "message": f"Failed to fetch datasources: {e!s}"}
  • The tool definition/registration in the MCP server list.
    {
        "name": "grafana_fetch_datasources",
        "description": "Fetches all datasources from Grafana with their configuration details.",
        "inputSchema": {"type": "object", "properties": {}, "required": []},
    },
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. While 'fetches' implies a read operation, it doesn't specify authentication requirements, rate limits, pagination behavior, error conditions, or what 'configuration details' specifically includes. The description is too minimal for a tool that presumably interacts with an external API.

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 communicates the core purpose without any wasted words. It's appropriately sized for a zero-parameter tool and front-loads the essential information immediately.

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 that fetches data from an external system (Grafana) with no annotations and no output schema, the description is insufficient. It doesn't explain what 'configuration details' includes, how results are structured, whether authentication is required, or any operational constraints. The agent would need to guess about important behavioral aspects.

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

Parameters4/5

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

The tool has zero parameters with 100% schema description coverage, so the schema already fully documents the parameter situation. The description appropriately doesn't discuss parameters since none exist, maintaining focus on the tool's purpose rather than attempting to describe non-existent inputs.

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 ('fetches') and resource ('all datasources from Grafana with their configuration details'), making the purpose immediately understandable. However, it doesn't distinguish this tool from potential sibling alternatives like 'grafana_fetch_folders' or 'grafana_fetch_all_dashboards' beyond the resource type.

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. With sibling tools like 'grafana_fetch_folders' and 'grafana_fetch_all_dashboards' available, there's no indication of when datasource fetching is appropriate versus other Grafana resource types, nor any mention of prerequisites or constraints.

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/DrDroidLab/grafana-mcp-server'

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