Skip to main content
Glama

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") },

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