Skip to main content
Glama
ampcome-mcps

CircleCI MCP Server

by ampcome-mcps

get_job_test_results

Retrieve test metadata from CircleCI jobs to check test status, identify failures, and analyze results for specific projects, branches, or pipelines.

Instructions

This tool retrieves test metadata for a CircleCI job.

PRIORITY USE CASE:
- When asked "are tests passing in CI?" or similar questions about test status
- When asked to "fix failed tests in CI" or help with CI test failures
- Use this tool to check if tests are passing in CircleCI and identify failed tests

Common use cases:
- Get test metadata for a specific job
- Get test metadata for all jobs in a project
- Get test metadata for a specific branch
- Get test metadata for a specific pipeline
- Get test metadata for a specific workflow
- Get test metadata for a specific job

CRITICAL REQUIREMENTS:
1. Truncation Handling (HIGHEST PRIORITY):
   - ALWAYS check for <MCPTruncationWarning> in the output
   - When present, you MUST start your response with:
     "WARNING: The test results have been truncated. Only showing the most recent entries. Some test data may not be visible."
   - Only proceed with test result analysis after acknowledging the truncation

2. Test Result Filtering:
   - Use filterByTestsResult parameter to filter test results:
     * filterByTestsResult: 'failure' - Show only failed tests
     * filterByTestsResult: 'success' - Show only successful tests
   - When looking for failed tests, ALWAYS set filterByTestsResult to 'failure'
   - When checking if tests are passing, set filterByTestsResult to 'success'

Input options (EXACTLY ONE of these THREE options must be used):

Option 1 - Project Slug and branch (BOTH required):
- projectSlug: The project slug obtained from listFollowedProjects tool (e.g., "gh/organization/project")
- branch: The name of the branch (required when using projectSlug)

Option 2 - Direct URL (provide ONE of these):
- projectURL: The URL of the CircleCI job in any of these formats:
  * Job URL: https://app.circleci.com/pipelines/gh/organization/project/123/workflows/abc-def/jobs/789
  * Workflow URL: https://app.circleci.com/pipelines/gh/organization/project/123/workflows/abc-def
  * Pipeline URL: https://app.circleci.com/pipelines/gh/organization/project/123

Option 3 - Project Detection (ALL of these must be provided together):
- workspaceRoot: The absolute path to the workspace root
- gitRemoteURL: The URL of the git remote repository
- branch: The name of the current branch

For simple test status checks (e.g., "are tests passing in CI?") or fixing failed tests, prefer Option 1 with a recent pipeline URL if available.

Additional Requirements:
- Never call this tool with incomplete parameters
- If using Option 1, make sure to extract the projectSlug exactly as provided by listFollowedProjects and include the branch parameter
- If using Option 2, the URL MUST be provided by the user - do not attempt to construct or guess URLs
- If using Option 3, ALL THREE parameters (workspaceRoot, gitRemoteURL, branch) must be provided
- If none of the options can be fully satisfied, ask the user for the missing information before making the tool call

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsNo

Implementation Reference

  • The main handler function that implements the logic for retrieving and formatting job test results based on provided parameters like projectSlug, branch, projectURL, etc. It determines the project slug, fetches test results using getJobTests, and formats them.
    export const getJobTestResults: ToolCallback<{
      params: typeof getJobTestResultsInputSchema;
    }> = async (args) => {
      const {
        workspaceRoot,
        gitRemoteURL,
        branch,
        projectURL,
        filterByTestsResult,
        projectSlug: inputProjectSlug,
      } = args.params;
    
      let pipelineNumber: number | undefined;
      let projectSlug: string | undefined;
      let jobNumber: number | undefined;
      let branchFromURL: string | undefined;
    
      if (inputProjectSlug) {
        if (!branch) {
          return mcpErrorOutput(
            'Branch not provided. When using projectSlug, a branch must also be specified.',
          );
        }
        projectSlug = inputProjectSlug;
      } else if (projectURL) {
        pipelineNumber = getPipelineNumberFromURL(projectURL);
        projectSlug = getProjectSlugFromURL(projectURL);
        branchFromURL = getBranchFromURL(projectURL);
        jobNumber = getJobNumberFromURL(projectURL);
      } else if (workspaceRoot && gitRemoteURL && branch) {
        projectSlug = await identifyProjectSlug({
          gitRemoteURL,
        });
      } else {
        return mcpErrorOutput(
          'Missing required inputs. Please provide either: 1) projectSlug with branch, 2) projectURL, or 3) workspaceRoot with gitRemoteURL and branch.',
        );
      }
    
      if (!projectSlug) {
        return mcpErrorOutput(`
          Project not found. Please provide a valid project URL or project information.
    
          Project slug: ${projectSlug}
          Git remote URL: ${gitRemoteURL}
          Branch: ${branch}
        `);
      }
    
      const testResults = await getJobTests({
        projectSlug,
        pipelineNumber,
        branch: branchFromURL || branch,
        jobNumber,
        filterByTestsResult,
      });
    
      return formatJobTests(testResults);
    };
  • Zod schema defining the input parameters for the get_job_test_results tool, including optional fields for projectSlug, branch, workspaceRoot, gitRemoteURL, projectURL, and filterByTestsResult.
    export const getJobTestResultsInputSchema = z.object({
      projectSlug: z.string().describe(projectSlugDescription).optional(),
      branch: z.string().describe(branchDescription).optional(),
      workspaceRoot: z
        .string()
        .describe(
          'The absolute path to the root directory of your project workspace. ' +
            'This should be the top-level folder containing your source code, configuration files, and dependencies. ' +
            'For example: "/home/user/my-project" or "C:\\Users\\user\\my-project"',
        )
        .optional(),
      gitRemoteURL: z
        .string()
        .describe(
          'The URL of the remote git repository. This should be the URL of the repository that you cloned to your local workspace. ' +
            'For example: "https://github.com/user/my-project.git"',
        )
        .optional(),
      projectURL: z
        .string()
        .describe(
          'The URL of the CircleCI project. Can be any of these formats:\n' +
            '- Project URL: https://app.circleci.com/pipelines/gh/organization/project\n' +
            '- Project URL with branch: https://app.circleci.com/pipelines/gh/organization/project?branch=feature-branch\n' +
            '- Pipeline URL: https://app.circleci.com/pipelines/gh/organization/project/123\n' +
            '- Workflow URL: https://app.circleci.com/pipelines/gh/organization/project/123/workflows/abc-def\n' +
            '- Job URL: https://app.circleci.com/pipelines/gh/organization/project/123/workflows/abc-def/jobs/123',
        )
        .optional(),
      filterByTestsResult: z
        .enum(['failure', 'success'])
        .describe(
          `Filter the tests by result.
          If "failure", only failed tests will be returned.
          If "success", only successful tests will be returned.
          `,
        )
        .optional(),
    });
  • Defines the tool object getJobTestResultsTool with name 'get_job_test_results', detailed description, and references the input schema.
    export const getJobTestResultsTool = {
      name: 'get_job_test_results' as const,
      description: `
        This tool retrieves test metadata for a CircleCI job.
    
        PRIORITY USE CASE:
        - When asked "are tests passing in CI?" or similar questions about test status
        - When asked to "fix failed tests in CI" or help with CI test failures
        - Use this tool to check if tests are passing in CircleCI and identify failed tests
        
        Common use cases:
        - Get test metadata for a specific job
        - Get test metadata for all jobs in a project
        - Get test metadata for a specific branch
        - Get test metadata for a specific pipeline
        - Get test metadata for a specific workflow
        - Get test metadata for a specific job
    
        CRITICAL REQUIREMENTS:
        1. Truncation Handling (HIGHEST PRIORITY):
           - ALWAYS check for <MCPTruncationWarning> in the output
           - When present, you MUST start your response with:
             "WARNING: The test results have been truncated. Only showing the most recent entries. Some test data may not be visible."
           - Only proceed with test result analysis after acknowledging the truncation
    
        2. Test Result Filtering:
           - Use filterByTestsResult parameter to filter test results:
             * filterByTestsResult: 'failure' - Show only failed tests
             * filterByTestsResult: 'success' - Show only successful tests
           - When looking for failed tests, ALWAYS set filterByTestsResult to 'failure'
           - When checking if tests are passing, set filterByTestsResult to 'success'
    
        Input options (EXACTLY ONE of these THREE options must be used):
    
        ${option1DescriptionBranchRequired}
    
        Option 2 - Direct URL (provide ONE of these):
        - projectURL: The URL of the CircleCI job in any of these formats:
          * Job URL: https://app.circleci.com/pipelines/gh/organization/project/123/workflows/abc-def/jobs/789
          * Workflow URL: https://app.circleci.com/pipelines/gh/organization/project/123/workflows/abc-def
          * Pipeline URL: https://app.circleci.com/pipelines/gh/organization/project/123
    
        Option 3 - Project Detection (ALL of these must be provided together):
        - workspaceRoot: The absolute path to the workspace root
        - gitRemoteURL: The URL of the git remote repository
        - branch: The name of the current branch
        
        For simple test status checks (e.g., "are tests passing in CI?") or fixing failed tests, prefer Option 1 with a recent pipeline URL if available.
    
        Additional Requirements:
        - Never call this tool with incomplete parameters
        - If using Option 1, make sure to extract the projectSlug exactly as provided by listFollowedProjects and include the branch parameter
        - If using Option 2, the URL MUST be provided by the user - do not attempt to construct or guess URLs
        - If using Option 3, ALL THREE parameters (workspaceRoot, gitRemoteURL, branch) must be provided
        - If none of the options can be fully satisfied, ask the user for the missing information before making the tool call
        `,
      inputSchema: getJobTestResultsInputSchema,
    };
  • Registers the getJobTestResultsTool in the CCI_TOOLS array (line 34) and maps 'get_job_test_results' to getJobTestResults handler in CCI_HANDLERS (line 62). Includes imports at lines 8-9.
    export const CCI_TOOLS = [
      getBuildFailureLogsTool,
      getFlakyTestLogsTool,
      getLatestPipelineStatusTool,
      getJobTestResultsTool,
      configHelperTool,
      createPromptTemplateTool,
      recommendPromptTemplateTestsTool,
      runPipelineTool,
      listFollowedProjectsTool,
      runEvaluationTestsTool,
      rerunWorkflowTool,
      analyzeDiffTool,
      runRollbackPipelineTool,
    ];
    
    // Extract the tool names as a union type
    type CCIToolName = (typeof CCI_TOOLS)[number]['name'];
    
    export type ToolHandler<T extends CCIToolName> = ToolCallback<{
      params: Extract<(typeof CCI_TOOLS)[number], { name: T }>['inputSchema'];
    }>;
    
    // Create a type for the tool handlers that directly maps each tool to its appropriate input schema
    type ToolHandlers = {
      [K in CCIToolName]: ToolHandler<K>;
    };
    
    export const CCI_HANDLERS = {
      get_build_failure_logs: getBuildFailureLogs,
      find_flaky_tests: getFlakyTestLogs,
      get_latest_pipeline_status: getLatestPipelineStatus,
      get_job_test_results: getJobTestResults,
      config_helper: configHelper,
      create_prompt_template: createPromptTemplate,
      recommend_prompt_template_tests: recommendPromptTemplateTests,
      run_pipeline: runPipeline,
      list_followed_projects: listFollowedProjects,
      run_evaluation_tests: runEvaluationTests,
      rerun_workflow: rerunWorkflow,
      analyze_diff: analyzeDiff,
      run_rollback_pipeline: runRollbackPipeline,
    } satisfies ToolHandlers;
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes critical behavioral traits: truncation handling (checking for <MCPTruncationWarning>, required warning message), test result filtering logic (how to use filterByTestsResult parameter), and strict parameter requirements (exactly one of three options, never call with incomplete parameters). However, it doesn't cover rate limits, authentication needs, or error handling scenarios.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (PRIORITY USE CASE, CRITICAL REQUIREMENTS, Input options), but it's overly verbose with repetitive information (e.g., 'Get test metadata for...' listed six times). Some sentences could be more concise, and the 'Common use cases' section adds little value beyond what's already implied.

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?

For a tool with 6 parameters, no annotations, and no output schema, the description provides substantial context: purpose, usage guidelines, behavioral requirements, and detailed parameter semantics. It effectively guides the agent on how to invoke the tool correctly. The main gap is the lack of output format information, which would be helpful given the complexity of test metadata.

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?

Given 0% schema description coverage (schema has no descriptions for properties), the description fully compensates by providing extensive parameter semantics. It explains all six parameters through three clear options, defines their relationships (e.g., 'Option 1 - Project Slug and branch (BOTH required)'), and adds practical guidance like 'Never call this tool with incomplete parameters' and format examples for URLs.

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 with specific verb ('retrieves') and resource ('test metadata for a CircleCI job'), distinguishing it from siblings like 'get_latest_pipeline_status' (status vs. metadata) and 'get_build_failure_logs' (logs vs. metadata). It explicitly identifies what the tool does beyond just the name.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool (e.g., 'When asked "are tests passing in CI?" or similar questions about test status') and includes priority use cases. It also distinguishes when to use specific parameter options (e.g., 'For simple test status checks... prefer Option 1 with a recent pipeline URL if available'), offering clear alternatives within the tool itself.

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/ampcome-mcps/circleci-mcp'

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