Skip to main content
Glama

get_copilot_usage_summary

Retrieve GitHub Copilot usage metrics across Enterprise, Organization, and seat assignments. Monitor code completions, chat activity, and active users with optional team-level data.

Instructions

Get a combined summary of Copilot usage across Enterprise, Organization, and seat assignments. Optionally include team-level metrics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sinceNoStart date in YYYY-MM-DD format (defaults to 28 days ago)
untilNoEnd date in YYYY-MM-DD format (defaults to today)
team_slugNoTeam slug to include team-level metrics
force_refreshNoIgnore cache and fetch fresh data

Implementation Reference

  • The handler function for the get_copilot_usage_summary tool that fetches and aggregates usage metrics.
      async ({ since, until, team_slug, force_refresh }) => {
        try {
          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;
          const fr = force_refresh ?? false;
    
          validateDateRange(s, u);
          if (team_slug) validateTeamSlug(team_slug);
    
          const summary: UsageSummary = {
            enterprise: { error: "Not configured" },
            org: { error: "Not configured" },
            seats: { error: "Not configured" },
          };
    
          // Enterprise metrics
          if (defaultEnterprise) {
            try {
              summary.enterprise = await client.fetchMetrics("enterprise", defaultEnterprise, s, u, fr, { identifier: defaultEnterprise });
            } catch (e) {
              summary.enterprise = { error: e instanceof Error ? e.message : String(e) };
            }
          }
    
          // Org metrics
          if (defaultOrg) {
            try {
              summary.org = await client.fetchMetrics("org", defaultOrg, s, u, fr, { identifier: defaultOrg });
            } catch (e) {
              summary.org = { error: e instanceof Error ? e.message : String(e) };
            }
    
            // Seats
            try {
              summary.seats = await client.fetchSeats(defaultOrg, fr);
            } catch (e) {
              summary.seats = { error: e instanceof Error ? e.message : String(e) };
            }
          }
    
          // Team metrics (optional)
          if (team_slug && defaultOrg) {
            try {
              const cacheSlug = `${defaultOrg}/${team_slug}`;
              summary.team = await client.fetchMetrics("team", cacheSlug, s, u, fr, { identifier: defaultOrg, teamSlug: team_slug });
            } catch (e) {
              summary.team = { error: e instanceof Error ? e.message : String(e) };
            }
          }
    
          return { content: [{ type: "text", text: JSON.stringify(summary, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
  • Registration of the get_copilot_usage_summary tool in the MCP server.
    server.tool(
      "get_copilot_usage_summary",
      "Get a combined summary of Copilot usage across Enterprise, Organization, and seat assignments. Optionally include team-level metrics.",
      {
        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)"),
        team_slug: z.string().optional().describe("Team slug to include team-level metrics"),
        force_refresh: z.boolean().optional().describe("Ignore cache and fetch fresh data"),
      },
      async ({ since, until, team_slug, force_refresh }) => {
        try {
          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;
          const fr = force_refresh ?? false;
    
          validateDateRange(s, u);
          if (team_slug) validateTeamSlug(team_slug);
    
          const summary: UsageSummary = {
            enterprise: { error: "Not configured" },
            org: { error: "Not configured" },
            seats: { error: "Not configured" },
          };
    
          // Enterprise metrics
          if (defaultEnterprise) {
            try {
              summary.enterprise = await client.fetchMetrics("enterprise", defaultEnterprise, s, u, fr, { identifier: defaultEnterprise });
            } catch (e) {
              summary.enterprise = { error: e instanceof Error ? e.message : String(e) };
            }
          }
    
          // Org metrics
          if (defaultOrg) {
            try {
              summary.org = await client.fetchMetrics("org", defaultOrg, s, u, fr, { identifier: defaultOrg });
            } catch (e) {
              summary.org = { error: e instanceof Error ? e.message : String(e) };
            }
    
            // Seats
            try {
              summary.seats = await client.fetchSeats(defaultOrg, fr);
            } catch (e) {
              summary.seats = { error: e instanceof Error ? e.message : String(e) };
            }
          }
    
          // Team metrics (optional)
          if (team_slug && defaultOrg) {
            try {
              const cacheSlug = `${defaultOrg}/${team_slug}`;
              summary.team = await client.fetchMetrics("team", cacheSlug, s, u, fr, { identifier: defaultOrg, teamSlug: team_slug });
            } catch (e) {
              summary.team = { error: e instanceof Error ? e.message : String(e) };
            }
          }
    
          return { content: [{ type: "text", text: JSON.stringify(summary, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
Behavior3/5

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

With no annotations provided, the description carries the full burden. It describes the scope (combined summary across entities) and optional team metrics, but lacks details on permissions, rate limits, or response format. It adds some behavioral context but is incomplete for a tool with no annotations.

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 main purpose and includes an optional feature. There is no wasted text, making it highly concise and well-structured.

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 and no output schema, the description is moderately complete. It covers the tool's purpose and scope but lacks details on behavioral traits like authentication or return values. It's adequate but has clear gaps for a tool with four parameters and no structured output information.

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 all parameters. The description mentions 'optionally include team-level metrics,' which hints at the team_slug parameter but adds minimal semantic value beyond the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'combined summary of Copilot usage across Enterprise, Organization, and seat assignments,' making the purpose specific. It distinguishes from sibling tools by emphasizing the combined nature versus the individual metrics tools like get_copilot_metrics_for_enterprise.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool—for a combined summary rather than individual metrics—and mentions an optional feature for team-level metrics. However, it does not explicitly state when not to use it or name alternatives, though siblings are implied by context.

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