Skip to main content
Glama
0xteamhq

Grafana MCP Server

by 0xteamhq

list_oncall_teams

Retrieve a list of teams configured in Grafana OnCall to manage on-call rotations and incident response assignments.

Instructions

List teams configured in Grafana OnCall

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoThe page number to return

Implementation Reference

  • The ToolDefinition object for 'list_oncall_teams' containing the handler function that executes the tool logic: creates an OnCall API client, fetches teams from '/teams' endpoint with optional pagination, formats the response, and returns it.
    export const listOncallTeams: ToolDefinition = {
      name: 'list_oncall_teams',
      description: 'List teams configured in Grafana OnCall',
      inputSchema: ListOncallTeamsSchema,
      handler: async (params, context: ToolContext) => {
        try {
          const client = createOncallClient(context.config.grafanaConfig);
          
          const queryParams: any = {};
          if (params.page) queryParams.page = params.page;
          
          const response = await client.get('/teams', { params: queryParams });
          
          const teams = response.data.results || [];
          
          // Format the response
          const formatted = teams.map((team: any) => ({
            id: team.id,
            name: team.name,
            email: team.email,
            avatarUrl: team.avatar_url,
          }));
          
          return createToolResult(formatted);
        } catch (error: any) {
          return createErrorResult(error.response?.data?.detail || error.message);
        }
      },
    };
  • Zod input schema definition for the 'list_oncall_teams' tool, allowing optional page parameter for pagination.
    const ListOncallTeamsSchema = z.object({
      page: z.number().optional().describe('The page number to return'),
    });
  • The registerOncallTools function that registers the 'list_oncall_teams' tool (and other oncall tools) with the MCP server.
    export function registerOncallTools(server: any) {
      server.registerTool(listOncallSchedules);
      server.registerTool(listOncallTeams);
      server.registerTool(listOncallUsers);
      server.registerTool(getCurrentOncallUsers);
      server.registerTool(getOncallShift);
    }
  • src/cli.ts:119-120 (registration)
    The call to registerOncallTools in the CLI entrypoint, conditionally enabling oncall tools including 'list_oncall_teams' based on configuration.
    if (enabledTools.has('oncall')) {
      registerOncallTools(server);
  • Helper function createOncallClient used by the handler to create an axios client configured for Grafana OnCall API with authentication.
    function createOncallClient(config: any) {
      const headers: any = {
        'User-Agent': 'mcp-grafana/1.0.0',
      };
      
      if (config.serviceAccountToken) {
        headers['Authorization'] = `Bearer ${config.serviceAccountToken}`;
      } else if (config.apiKey) {
        headers['Authorization'] = `Bearer ${config.apiKey}`;
      }
      
      return axios.create({
        baseURL: `${config.url}/api/plugins/grafana-oncall-app/resources/api/v1`,
        headers,
        timeout: 30000,
      });
    }
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 'List' implies a read operation, it doesn't mention whether this requires authentication, what format the results come in, whether it's paginated (though the page parameter suggests it is), or any rate limits. The description is minimal and leaves important behavioral aspects unspecified.

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 states exactly what the tool does with zero wasted words. It's appropriately sized for a simple listing tool and gets straight to the point without unnecessary elaboration.

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?

For a simple listing tool with one documented parameter and no output schema, the description is minimally adequate. However, without annotations and with sibling tools that could cause confusion, it should ideally provide more context about what 'teams configured in Grafana OnCall' means specifically and how this differs from other team listing tools.

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%, so the schema already documents the single 'page' parameter. The description doesn't add any parameter information beyond what's in the schema, nor does it explain the pagination behavior or default values. This meets the baseline expectation when schema coverage is complete.

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 verb ('List') and resource ('teams configured in Grafana OnCall'), making the purpose specific and understandable. However, it doesn't distinguish this tool from its sibling 'list_teams' (which appears to list general Grafana teams), leaving some ambiguity about the exact scope differentiation.

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 'list_teams' and 'get_current_oncall_users' available, there's no indication of when this specific oncall team listing is appropriate versus those other team/user listing tools.

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