Skip to main content
Glama
0xteamhq

Grafana MCP Server

by 0xteamhq

list_teams

Search for Grafana teams using a query string to find and retrieve detailed information about matching teams within your Grafana instance.

Instructions

Search for Grafana teams by a query string. Returns a list of matching teams with details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoThe query to search for teams

Implementation Reference

  • The handler function for the 'list_teams' tool. It instantiates a GrafanaClient, calls listTeams with the optional query parameter, formats the team data (id, name, email, memberCount), and returns the result or an error.
    handler: async (params, context: ToolContext) => { try { const client = new GrafanaClient(context.config.grafanaConfig); const teams = await client.listTeams(params.query); // Format the response const formatted = teams.map(team => ({ id: team.id, name: team.name, email: team.email, memberCount: team.memberCount, })); return createToolResult(formatted); } catch (error: any) { return createErrorResult(error.message); } },
  • Zod schema defining the input for list_teams tool: optional 'query' string to search for teams.
    const ListTeamsSchema = z.object({ query: z.string().optional().describe('The query to search for teams'), });
  • Registers the 'list_teams' tool definition with the MCP server inside the registerAdminTools function.
    server.registerTool(listTeams);
  • GrafanaClient method that performs the API call to /api/teams/search with optional query parameter, used by the tool handler.
    async listTeams(query?: string): Promise<Team[]> { try { const response = await this.client.get('/api/teams/search', { params: { query }, }); return response.data.teams; } catch (error) { this.handleError(error); } }
  • src/cli.ts:123-123 (registration)
    Invocation of registerAdminTools which registers the 'list_teams' tool, conditionally if 'admin' category is enabled.
    registerAdminTools(server);

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