Skip to main content
Glama

get_copilot_metrics_for_team

Retrieve daily GitHub Copilot usage metrics for a specific team, including code completions, chat activity, and active user counts within a defined date range.

Instructions

Get daily Copilot usage metrics for a specific team within an Organization

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orgNoOrganization name (defaults to GITHUB_ORG env var)
team_slugYesTeam slug (required)
sinceNoStart date in YYYY-MM-DD format (defaults to 28 days ago)
untilNoEnd date in YYYY-MM-DD format (defaults to today)
force_refreshNoIgnore cache and fetch fresh data

Implementation Reference

  • The handler function that executes the logic for 'get_copilot_metrics_for_team', including parameter validation and client data fetching.
    async ({ org, team_slug, since, until, force_refresh }) => {
      try {
        const o = org ?? defaultOrg;
        if (!o) {
          return { content: [{ type: "text", text: "Organization name is required. Set GITHUB_ORG or pass 'org' parameter." }], isError: true };
        }
        validateTeamSlug(team_slug);
    
        const today = new Date().toISOString().split("T")[0];
        const defaultSince = new Date();
        defaultSince.setUTCDate(defaultSince.getUTCDate() - 28);
        const s = since ?? defaultSince.toISOString().split("T")[0];
        const u = until ?? today;
    
        validateDateRange(s, u);
    
        const cacheSlug = `${o}/${team_slug}`;
        const metrics = await client.fetchMetrics("team", cacheSlug, s, u, force_refresh ?? false, { identifier: o, teamSlug: team_slug });
    
        return { content: [{ type: "text", text: JSON.stringify(metrics, null, 2) }] };
      } catch (error) {
        return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
      }
    }
  • The Zod schema definition for input parameters of 'get_copilot_metrics_for_team'.
    {
      org: z.string().optional().describe("Organization name (defaults to GITHUB_ORG env var)"),
      team_slug: z.string().describe("Team slug (required)"),
      since: z.string().optional().describe("Start date in YYYY-MM-DD format (defaults to 28 days ago)"),
      until: z.string().optional().describe("End date in YYYY-MM-DD format (defaults to today)"),
      force_refresh: z.boolean().optional().describe("Ignore cache and fetch fresh data"),
    },
  • src/tools/team.ts:7-41 (registration)
    The tool registration call within 'registerTeamTool'.
    server.tool(
      "get_copilot_metrics_for_team",
      "Get daily Copilot usage metrics for a specific team within an Organization",
      {
        org: z.string().optional().describe("Organization name (defaults to GITHUB_ORG env var)"),
        team_slug: z.string().describe("Team slug (required)"),
        since: z.string().optional().describe("Start date in YYYY-MM-DD format (defaults to 28 days ago)"),
        until: z.string().optional().describe("End date in YYYY-MM-DD format (defaults to today)"),
        force_refresh: z.boolean().optional().describe("Ignore cache and fetch fresh data"),
      },
      async ({ org, team_slug, since, until, force_refresh }) => {
        try {
          const o = org ?? defaultOrg;
          if (!o) {
            return { content: [{ type: "text", text: "Organization name is required. Set GITHUB_ORG or pass 'org' parameter." }], isError: true };
          }
          validateTeamSlug(team_slug);
    
          const today = new Date().toISOString().split("T")[0];
          const defaultSince = new Date();
          defaultSince.setUTCDate(defaultSince.getUTCDate() - 28);
          const s = since ?? defaultSince.toISOString().split("T")[0];
          const u = until ?? today;
    
          validateDateRange(s, u);
    
          const cacheSlug = `${o}/${team_slug}`;
          const metrics = await client.fetchMetrics("team", cacheSlug, s, u, force_refresh ?? false, { identifier: o, teamSlug: team_slug });
    
          return { content: [{ type: "text", text: JSON.stringify(metrics, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden but only states what the tool does without disclosing behavioral traits. It doesn't mention permissions needed, rate limits, data freshness (beyond 'force_refresh' param), error handling, or output format, leaving significant gaps for a tool with 5 parameters.

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 front-loads the core purpose without unnecessary words. It directly communicates the tool's function, making it easy to parse and understand quickly.

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?

Given the tool's complexity (5 parameters, no annotations, no output schema), the description is insufficient. It lacks details on behavioral aspects, output structure, error conditions, and usage context relative to siblings, leaving the agent with incomplete information for effective tool invocation.

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 parameters are well-documented in the schema. The description adds no additional semantic context beyond implying 'team' scope, which is already covered by the 'team_slug' parameter. Baseline 3 is appropriate as the schema handles parameter documentation adequately.

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 ('Get daily Copilot usage metrics') and target resource ('for a specific team within an Organization'), making the purpose understandable. It distinguishes from sibling tools like 'get_copilot_metrics_for_enterprise' and 'get_copilot_metrics_for_org' by specifying 'team' scope, though it doesn't explicitly contrast them.

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?

No explicit guidance on when to use this tool versus alternatives like 'get_copilot_metrics_for_org' or 'get_copilot_usage_summary' is provided. The description implies usage for team-level metrics but lacks context on prerequisites, exclusions, or comparative scenarios.

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/tatsuyamiyazaki/copilot-usage-mcp'

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