Skip to main content
Glama
gcorroto
by gcorroto

jenkins_get_git_branches

Retrieve available Git branches for a Jenkins job to configure builds or check code versions.

Instructions

Obtener las ramas de Git disponibles para un job

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appYesNombre de la aplicación

Implementation Reference

  • Core handler function in JenkinsService that fetches Git branches from the Jenkins GitParameterDefinition endpoint using a specific API call.
    async getGitBranches(app: string): Promise<string[]> {
      if (!validateAppName(app)) {
        throw new Error('Invalid app name.');
      }
    
      // Para obtener branches, usamos el job principal sin branch específico
      const url = `${buildJobUrl('', app, 'main')}/descriptorByName/net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition/fillValueItems?param=BRANCH_TO_BUILD`;
      
      try {
        const response: AxiosResponse<{ values: GitBranch[] }> = await this.client.get(url);
        return response.data.values.map(branch => branch.name);
      } catch (error: any) {
        throw handleHttpError(error, `Failed to get Git branches for app: ${app}`);
      }
    }
  • index.ts:368-391 (registration)
    MCP tool registration including schema (app: string), description, and thin handler that calls the service method and formats the markdown response.
      "jenkins_get_git_branches",
      "Obtener las ramas de Git disponibles para un job",
      {
        app: z.string().describe("Nombre de la aplicación")
      },
      async (args) => {
        try {
          const result = await getJenkinsService().getGitBranches(args.app);
          
          const branchesText = `🌿 **Ramas de Git Disponibles - ${args.app}**\n\n` +
            `**Total de ramas:** ${result.length}\n\n` +
            result.slice(0, 15).map((branch, index) => `${index + 1}. ${branch}`).join('\n') +
            (result.length > 15 ? `\n\n... y ${result.length - 15} ramas más` : '');
    
          return {
            content: [{ type: "text", text: branchesText }],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `❌ **Error:** ${error.message}` }],
          };
        }
      }
    );
  • Input schema definition for the tool using Zod: requires 'app' as string.
    {
      app: z.string().describe("Nombre de la aplicación")
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves Git branches for a job, implying a read-only operation, but doesn't specify whether it requires authentication, rate limits, error handling, or the format of the returned data. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior and constraints.

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, clear sentence in Spanish: 'Obtener las ramas de Git disponibles para un job'. It is front-loaded with the core purpose, has no redundant information, and efficiently communicates the tool's function without unnecessary elaboration.

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 (retrieving Git branches from Jenkins), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what data is returned, potential errors, or dependencies on Jenkins job configurations. For a tool interacting with version control in a CI/CD system, more context is needed to ensure proper usage by an AI agent.

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?

The input schema has 100% description coverage, with one parameter 'app' documented as 'Nombre de la aplicación' (Name of the application). The description adds no additional semantic details beyond what the schema provides, such as clarifying what 'app' refers to in the Jenkins context or how it relates to the job. Baseline score of 3 is appropriate since 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 tool's purpose: 'Obtener las ramas de Git disponibles para un job' (Get the available Git branches for a job). It specifies the verb 'obtener' (get) and the resource 'ramas de Git' (Git branches) with the context 'para un job' (for a job). However, it doesn't explicitly differentiate from sibling tools like 'jenkins_get_job_status' or 'jenkins_get_build_steps', which focus on different aspects of Jenkins jobs.

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 prerequisites, such as needing a specific Jenkins job configuration, or compare it to sibling tools like 'jenkins_get_job_status' for job details or 'jenkins_start_job' for job execution. Usage is implied by the purpose but lacks explicit context or exclusions.

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