Skip to main content
Glama
hekmon8

Jenkins Server MCP

by hekmon8

trigger_build

Initiate a Jenkins CI/CD build by specifying the job path and optional parameters using this tool on the Jenkins Server MCP.

Instructions

Trigger a new Jenkins build

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jobPathYesPath to the Jenkins job
parametersYesBuild parameters (optional)

Implementation Reference

  • The handler function that implements the trigger_build tool. It constructs URL parameters from the input 'parameters' object and sends a POST request to the Jenkins job's buildWithParameters endpoint to trigger the build. Returns a success message.
    private async triggerBuild(args: any) {
      const params = new URLSearchParams();
      if (args.parameters) {
        Object.entries(args.parameters).forEach(([key, value]) => {
          params.append(key, String(value));
        });
      }
    
      await this.axiosInstance.post(
        `/${args.jobPath}/buildWithParameters`,
        params
      );
    
      return {
        content: [
          {
            type: 'text',
            text: 'Build triggered successfully',
          },
        ],
      };
    }
  • Input schema for the trigger_build tool, requiring 'jobPath' (string) and 'parameters' (object). Defines the expected input structure for validation.
    inputSchema: {
      type: 'object',
      properties: {
        jobPath: {
          type: 'string',
          description: 'Path to the Jenkins job',
        },
        parameters: {
          type: 'object',
          description: 'Build parameters (optional)',
          additionalProperties: true,
        },
      },
      required: ['jobPath', 'parameters'],
    },
  • src/index.ts:80-98 (registration)
    Registration of the trigger_build tool in the ListTools response, including name, description, and input schema.
    {
      name: 'trigger_build',
      description: 'Trigger a new Jenkins build',
      inputSchema: {
        type: 'object',
        properties: {
          jobPath: {
            type: 'string',
            description: 'Path to the Jenkins job',
          },
          parameters: {
            type: 'object',
            description: 'Build parameters (optional)',
            additionalProperties: true,
          },
        },
        required: ['jobPath', 'parameters'],
      },
    },
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