Skip to main content
Glama
0xteamhq

Grafana MCP Server

by 0xteamhq

search_dashboards

Search Grafana dashboards using a query string to find relevant monitoring dashboards with details like title, UID, folder, tags, and URL.

Instructions

Search for Grafana dashboards by a query string. Returns a list of matching dashboards with details like title, UID, folder, tags, and URL.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe query to search for

Implementation Reference

  • The handler function for the 'search_dashboards' tool that instantiates GrafanaClient, performs the dashboard search with the input query, formats the results for readability, and returns success or error.
    handler: async (params, context: ToolContext) => {
      try {
        const client = new GrafanaClient(context.config.grafanaConfig);
        const results = await client.searchDashboards(params.query);
        
        // Format results for better readability
        const formatted = results.map(dashboard => ({
          uid: dashboard.uid,
          title: dashboard.title,
          url: dashboard.url,
          tags: dashboard.tags || [],
          folderTitle: dashboard.folderTitle,
          type: dashboard.type,
        }));
        
        return createToolResult(formatted);
      } catch (error: any) {
        return createErrorResult(error.message);
      }
    },
  • Zod input schema for the 'search_dashboards' tool defining the required 'query' string parameter.
    const SearchDashboardsSchema = z.object({
      query: z.string().describe('The query to search for'),
    });
  • Registration function that registers the 'search_dashboards' tool with the MCP server.
    export function registerSearchTools(server: any) {
      server.registerTool(searchDashboards);
    }
  • src/cli.ts:98-100 (registration)
    Conditional invocation of search tools registration (including 'search_dashboards') when the 'search' category is enabled.
    if (enabledTools.has('search')) {
      registerSearchTools(server);
    }
  • GrafanaClient helper method that calls the Grafana API /api/search endpoint to search for dashboards by query, filtering by dashboard type.
    async searchDashboards(query: string): Promise<any[]> {
      try {
        const response = await this.client.get('/api/search', {
          params: { query, type: 'dash-db' },
        });
        return response.data;
      } catch (error) {
        this.handleError(error);
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool returns a list of matching dashboards with details, which covers basic behavior, but lacks critical information: it doesn't mention pagination, rate limits, authentication requirements, error handling, or whether it's read-only (implied but not explicit). For a search tool with zero annotation coverage, this is insufficient.

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 two concise sentences: the first states the purpose, the second details the return value. It's front-loaded with the core function and wastes no words, making it easy to parse quickly.

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

Completeness3/5

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

Given no annotations, no output schema, and a simple single-parameter input schema, the description provides basic completeness: it covers what the tool does and what it returns. However, it lacks details on behavioral aspects like pagination or error handling, which are important for a search operation. It's adequate but has clear gaps.

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?

The input schema has 100% description coverage, with the 'query' parameter documented as 'The query to search for'. The description adds no additional meaning beyond this, such as query syntax examples or search scope details. Baseline 3 is appropriate when the schema does the heavy lifting.

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 tool's purpose: 'Search for Grafana dashboards by a query string' specifies the verb (search) and resource (Grafana dashboards). It distinguishes from siblings like 'get_dashboard_by_uid' (specific fetch) and 'update_dashboard' (mutation), but doesn't explicitly differentiate from other list/search tools like 'list_datasources'.

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

Usage Guidelines3/5

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

The description implies usage for searching dashboards with a query, but provides no explicit guidance on when to use this vs. alternatives like 'get_dashboard_by_uid' (for known UID) or 'list_datasources' (for other resources). It mentions returning a list with details, which suggests it's for broad searches, but lacks clear when/when-not criteria.

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