Skip to main content
Glama
hekmon8

Jenkins Server MCP

by hekmon8

get_build_status

Retrieve the current status of a Jenkins build by providing the job path and build number. Use 'lastBuild' to fetch the most recent build's status.

Instructions

Get the status of a Jenkins build

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
buildNumberNoBuild number (use "lastBuild" for most recent)
jobPathYesPath to the Jenkins job (e.g., "view/xxx_debug")

Implementation Reference

  • The handler function that executes the get_build_status tool: fetches build status from Jenkins API using axios and returns formatted JSON content.
    private async getBuildStatus(args: any) {
      const buildNumber = args.buildNumber || 'lastBuild';
      const response = await this.axiosInstance.get<BuildStatus>(
        `/${args.jobPath}/${buildNumber}/api/json`
      );
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              building: response.data.building,
              result: response.data.result,
              timestamp: response.data.timestamp,
              duration: response.data.duration,
              url: response.data.url,
            }, null, 2),
          },
        ],
      };
    }
  • src/index.ts:62-79 (registration)
    Tool registration in the ListTools handler, defining name, description, and input schema.
    {
      name: 'get_build_status',
      description: 'Get the status of a Jenkins build',
      inputSchema: {
        type: 'object',
        properties: {
          jobPath: {
            type: 'string',
            description: 'Path to the Jenkins job (e.g., "view/xxx_debug")',
          },
          buildNumber: {
            type: 'string',
            description: 'Build number (use "lastBuild" for most recent)',
          },
        },
        required: ['jobPath'],
      },
    },
  • TypeScript interface defining the structure of the Jenkins build status response used in the handler.
    interface BuildStatus {
      building: boolean;
      result: string | null;
      timestamp: number;
      duration: number;
      url: string;
    }
Install Server

Other Tools

Related 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/hekmon8/Jenkins-server-mcp'

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