Skip to main content
Glama
CircleCI-Public

mcp-server-circleci

Official

find_underused_resource_classes

Analyze CircleCI usage data to identify jobs with low CPU or RAM utilization, helping optimize resource allocation by finding oversized configurations.

Instructions

Analyzes a CircleCI usage data CSV file to find jobs/resource classes with average or max CPU/RAM usage below a given threshold (default 40%).
This helps identify underused resource classes that may be oversized for their workload.

Required parameter:
- csvFilePath: Path to the usage data CSV file (string). IMPORTANT: This must be an absolute path. If you are given a relative path, you must resolve it to an absolute path before calling this tool.

Optional parameter:
- threshold: Usage percentage threshold (number, default 40)

The tool expects the CSV to have columns: job_name, resource_class, median_cpu_utilization_pct, max_cpu_utilization_pct, median_ram_utilization_pct, max_ram_utilization_pct (case-insensitive). These required columns are a subset of the columns in the CircleCI usage API output and the tool will work with the full set of columns from the usage API CSV.
It returns a summary report listing all jobs/resource classes where any of these metrics is below the threshold.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsNo

Implementation Reference

  • The MCP tool handler function that extracts parameters, validates csvFilePath, calls the library analysis function, and returns the markdown report or error.
    export const findUnderusedResourceClasses: ToolCallback<{ params: typeof findUnderusedResourceClassesInputSchema }> = async (args) => {
      const { 
        csvFilePath, 
        threshold 
      } = args.params ?? {};
    
      if (!csvFilePath) {
        return mcpErrorOutput('ERROR: csvFilePath is required.');
      }
      try {
        const { report } = await findUnderusedResourceClassesFromCSV({ csvFilePath, threshold });
        return {
          content: [
            { type: 'text', text: report },
          ],
        };
      } catch (e: any) {
        return mcpErrorOutput(`ERROR: ${e && e.message ? e.message : e}`);
      }
    };
  • Zod schema defining the tool's input parameters: required csvFilePath (string) and optional threshold (number, default 40).
    export const findUnderusedResourceClassesInputSchema = z.object({
      csvFilePath: z
        .string()
        .describe('The path to the usage data CSV file to analyze.'),
      threshold: z
        .number()
        .optional()
        .default(40)
        .describe(
          'The usage percentage threshold. Jobs with usage below this will be reported. Default is 40.',
        ),
    });
  • Tool registration object defining the name 'find_underused_resource_classes', detailed description, and input schema reference.
    export const findUnderusedResourceClassesTool = {
      name: 'find_underused_resource_classes' as const,
      description: `
        Analyzes a CircleCI usage data CSV file to find jobs/resource classes with average or max CPU/RAM usage below a given threshold (default 40%).
        This helps identify underused resource classes that may be oversized for their workload.
    
        Required parameter:
        - csvFilePath: Path to the usage data CSV file (string). IMPORTANT: This must be an absolute path. If you are given a relative path, you must resolve it to an absolute path before calling this tool.
    
        Optional parameter:
        - threshold: Usage percentage threshold (number, default 40)
    
        The tool expects the CSV to have columns: job_name, resource_class, median_cpu_utilization_pct, max_cpu_utilization_pct, median_ram_utilization_pct, max_ram_utilization_pct (case-insensitive). These required columns are a subset of the columns in the CircleCI usage API output and the tool will work with the full set of columns from the usage API CSV.
        It returns a summary report listing all jobs/resource classes where any of these metrics is below the threshold.
      `,
      inputSchema: findUnderusedResourceClassesInputSchema,
    };
  • Central registration: the findUnderusedResourceClassesTool is included in the CCI_TOOLS array (line 50).
    export const CCI_TOOLS = [
      getBuildFailureLogsTool,
      getFlakyTestLogsTool,
      getLatestPipelineStatusTool,
      getJobTestResultsTool,
      configHelperTool,
      createPromptTemplateTool,
      recommendPromptTemplateTestsTool,
      runPipelineTool,
      listFollowedProjectsTool,
      runEvaluationTestsTool,
      rerunWorkflowTool,
      downloadUsageApiDataTool,
      findUnderusedResourceClassesTool,
      analyzeDiffTool,
      runRollbackPipelineTool,
      listComponentVersionsTool,
    ];
  • Core helper function that orchestrates CSV parsing, validation, grouping by job, analysis for underused resources based on threshold, and report generation.
    export async function findUnderusedResourceClassesFromCSV({ csvFilePath, threshold = 40 }: { csvFilePath: string, threshold?: number }) {
      const records = readAndParseCSV(csvFilePath);
      validateCSVColumns(records);
      const groupedRecords = groupRecordsByJob(records);
      const underusedJobs = analyzeJobGroups(groupedRecords, threshold);
      const report = generateReport(underusedJobs, threshold);
      
      return { report, underused: underusedJobs };
    }
Behavior4/5

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

With no annotations provided, the description carries full burden and adds valuable behavioral context. It discloses that the tool expects specific CSV columns (job_name, resource_class, etc.), works with a subset of CircleCI usage API output, and returns a summary report. It also notes that the CSV path must be absolute and provides a default threshold. However, it doesn't mention error handling, performance, or output format details, leaving some gaps.

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 appropriately sized and front-loaded: it starts with the core purpose, then details parameters and CSV requirements. Each sentence adds value—none are redundant. It uses bullet-like formatting for parameters and clear explanations without waste, making it easy to scan and understand.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (analyzing CSV data with specific columns), no annotations, no output schema, and 0% schema coverage, the description is largely complete. It covers purpose, parameters, CSV expectations, and output type ('summary report'). However, it doesn't detail the report's structure or potential errors, which could help an agent use it more effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds significant meaning beyond the input schema, which has 0% description coverage. It explains that 'csvFilePath' must be an absolute path and requires resolution if relative, and that 'threshold' is a usage percentage with default 40. It also clarifies the CSV column expectations and how the tool processes them. This fully compensates for the schema's lack of descriptions.

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 tool's purpose: 'Analyzes a CircleCI usage data CSV file to find jobs/resource classes with average or max CPU/RAM usage below a given threshold.' It specifies the verb ('analyzes'), resource ('CircleCI usage data CSV file'), and outcome ('find jobs/resource classes with usage below threshold'). It distinguishes from siblings by focusing on underused resource analysis rather than other CircleCI operations like downloading data or running pipelines.

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: to identify underused resource classes from CSV data. It implies usage with CircleCI usage API output. However, it does not explicitly state when not to use it or name alternatives among sibling tools (e.g., 'download_usage_api_data' for obtaining the CSV). The guidance is practical but lacks explicit exclusions or comparisons.

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/CircleCI-Public/mcp-server-circleci'

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