Skip to main content
Glama
gcorroto
by gcorroto

jenkins_get_job_status

Check the status of a specific Jenkins job to monitor CI/CD pipeline execution and identify build failures or successes.

Instructions

Obtener el estado de un job específico de Jenkins

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appYesNombre de la aplicación
branchNoRama de Git (por defecto: main)

Implementation Reference

  • Core handler function in JenkinsService that performs the API call to retrieve the job status from Jenkins, including input validation and comprehensive error handling.
    async getJobStatus(app: string, branch: string = 'main'): Promise<JobStatus> {
      if (!validateAppName(app)) {
        throw new Error('Invalid app name. Only alphanumeric characters, hyphens and underscores are allowed.');
      }
    
      const jobUrl = `${buildJobUrl('', app, branch)}/api/json`;
      
      try {
        const response: AxiosResponse<JobStatus> = await this.client.get(jobUrl);
        return response.data;
      } catch (error: any) {
        if (error.response?.status === 404) {
          throw new JenkinsError(`Job not found for app: ${app}, branch: ${branch} and url: ${jobUrl}`);
        }
        throw handleHttpError(error, `Failed to get job status for app: ${app}, branch: ${branch} and url: ${jobUrl}`);
      }
    }
  • index.ts:38-70 (registration)
    MCP tool registration using server.tool, defining the tool name, description, input schema with Zod, and the inline handler that formats the response from the service.
      "jenkins_get_job_status",
      "Obtener el estado de un job específico de Jenkins",
      {
        app: z.string().describe("Nombre de la aplicación"),
        branch: z.string().optional().describe("Rama de Git (por defecto: main)")
      },
      async (args) => {
        try {
          const result = await getJenkinsService().getJobStatus(args.app, args.branch || 'main');
          
          const lastBuild = result.lastBuild;
          const statusText = `🔧 **Estado del Job: ${result.displayName}**\n\n` +
            `**URL:** ${result.url}\n` +
            `**Estado:** ${result.color}\n` +
            `**Construible:** ${result.buildable ? '✅' : '❌'}\n` +
            `**Próximo build:** #${result.nextBuildNumber}\n\n` +
            (lastBuild ? 
              `**Último build:** #${lastBuild.number}\n` +
              `**Resultado:** ${lastBuild.result || 'En progreso'}\n` +
              `**Duración:** ${formatDuration(lastBuild.duration || 0)}\n` +
              `**Timestamp:** ${formatTimestamp(lastBuild.timestamp || 0)}`
              : 'Sin builds previos');
    
          return {
            content: [{ type: "text", text: statusText }],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `❌ **Error:** ${error.message}` }],
          };
        }
      }
    );
  • Zod input schema defining parameters 'app' (required string) and 'branch' (optional string).
    {
      app: z.string().describe("Nombre de la aplicación"),
      branch: z.string().optional().describe("Rama de Git (por defecto: main)")
  • TypeScript interface defining the structure of the JobStatus response from Jenkins API.
    export interface JobStatus {
      name: string;
      url: string;
      buildable: boolean;
      builds: Build[];
      color: string;
      displayName: string;
      lastBuild?: Build;
      lastCompletedBuild?: Build;
      lastFailedBuild?: Build;
      lastStableBuild?: Build;
      lastSuccessfulBuild?: Build;
      lastUnstableBuild?: Build;
      lastUnsuccessfulBuild?: Build;
      nextBuildNumber: number;
    }
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. It states this is a read operation ('Obtener' - Get), but provides no information about authentication requirements, rate limits, error conditions, or what the status output might include. For a tool with zero annotation coverage, this leaves significant behavioral 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 a single, efficient Spanish sentence that directly states the tool's purpose. There's no wasted language, repetition, or unnecessary elaboration. It's appropriately sized for a simple status-checking tool.

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 no annotations, no output schema, and a read operation that likely returns structured status information, the description is insufficient. It doesn't explain what 'estado' (status) includes, whether it returns simple status strings or complex job metadata, or any error handling. For a tool that presumably returns job status details, more context is needed.

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%, with both parameters clearly documented in the schema. The description adds no additional parameter information beyond what's already in the structured schema. According to scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in description.

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 ('Obtener el estado' - Get status) and target resource ('un job específico de Jenkins' - a specific Jenkins job). It distinguishes from siblings like jenkins_get_node_status (node vs job) and jenkins_get_build_steps (steps vs status), but doesn't explicitly differentiate from all siblings. The purpose is specific and understandable.

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. It doesn't mention when this tool is appropriate versus jenkins_get_node_status or jenkins_get_build_steps, nor does it provide any context about prerequisites or typical use cases. The agent must infer usage from the tool name alone.

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/gcorroto/mcp-jenkins'

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