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

NameRequiredDescriptionDefault
queryYesThe query to search for

Input Schema (JSON Schema)

{ "properties": { "query": { "description": "The query to search for", "type": "string" } }, "required": [ "query" ], "type": "object" }

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); } }

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