Skip to main content
Glama
cuongdev
by cuongdev

create_pipeline_webhook

Create a webhook for an AWS CodePipeline to enable automatic pipeline triggering based on external events, with configurable authentication and event filters.

Instructions

Create a webhook for a pipeline to enable automatic triggering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pipelineNameYesName of the pipeline
webhookNameYesName for the webhook
targetActionYesThe name of the action in the pipeline that processes the webhook
authenticationYesAuthentication method for the webhook
authenticationConfigurationNoAuthentication configuration based on the authentication type
filtersNoEvent filters for the webhook

Implementation Reference

  • The main handler function that implements the create_pipeline_webhook tool logic, creating and registering a webhook for an AWS CodePipeline using the AWS SDK.
    export async function createPipelineWebhook( codePipelineManager: CodePipelineManager, input: { pipelineName: string; webhookName: string; targetAction: string; authentication: string; authenticationConfiguration?: { SecretToken?: string; AllowedIpRange?: string; }; filters?: Array<{ jsonPath: string; matchEquals?: string; }>; } ) { const { pipelineName, webhookName, targetAction, authentication, authenticationConfiguration = {}, filters = [] } = input; const codepipeline = codePipelineManager.getCodePipeline(); // Create the webhook const response = await codepipeline.putWebhook({ webhook: { name: webhookName, targetPipeline: pipelineName, targetAction: targetAction, filters: filters.map(filter => ({ jsonPath: filter.jsonPath, matchEquals: filter.matchEquals })), authentication, authenticationConfiguration } }).promise(); // Register the webhook await codepipeline.registerWebhookWithThirdParty({ webhookName }).promise(); // Extract webhook details safely const webhookDetails = { name: webhookName, url: response.webhook ? String(response.webhook.url) : undefined, targetPipeline: pipelineName, targetAction: targetAction }; return { content: [ { type: "text", text: JSON.stringify({ message: "Pipeline webhook created and registered successfully", webhookDetails }, null, 2), }, ], }; }
  • The input schema and metadata definition for the create_pipeline_webhook tool, specifying parameters like pipelineName, webhookName, targetAction, authentication, etc.
    export const createPipelineWebhookSchema = { name: "create_pipeline_webhook", description: "Create a webhook for a pipeline to enable automatic triggering", inputSchema: { type: "object", properties: { pipelineName: { type: "string", description: "Name of the pipeline" }, webhookName: { type: "string", description: "Name for the webhook" }, targetAction: { type: "string", description: "The name of the action in the pipeline that processes the webhook" }, authentication: { type: "string", description: "Authentication method for the webhook", enum: ["GITHUB_HMAC", "IP", "UNAUTHENTICATED"] }, authenticationConfiguration: { type: "object", description: "Authentication configuration based on the authentication type", properties: { SecretToken: { type: "string", description: "Secret token for GITHUB_HMAC authentication" }, AllowedIpRange: { type: "string", description: "Allowed IP range for IP authentication" } } }, filters: { type: "array", description: "Event filters for the webhook", items: { type: "object", properties: { jsonPath: { type: "string", description: "JSON path to filter events" }, matchEquals: { type: "string", description: "Value to match in the JSON path" } }, required: ["jsonPath"] } } }, required: ["pipelineName", "webhookName", "targetAction", "authentication"], }, } as const;
  • src/index.ts:202-217 (registration)
    Registration of the create_pipeline_webhook tool in the MCP server's CallToolRequestHandler switch statement, dispatching calls to the handler function.
    case "create_pipeline_webhook": { return await createPipelineWebhook(codePipelineManager, input as { pipelineName: string; webhookName: string; targetAction: string; authentication: string; authenticationConfiguration?: { SecretToken?: string; AllowedIpRange?: string; }; filters?: Array<{ jsonPath: string; matchEquals?: string; }>; }); }
  • src/index.ts:61-63 (registration)
    Import statement for the create_pipeline_webhook handler and schema.
    createPipelineWebhook, createPipelineWebhookSchema } from "./tools/create_pipeline_webhook.js";
  • src/index.ts:124-124 (registration)
    Inclusion of the createPipelineWebhookSchema in the list of tools returned by ListToolsRequestHandler.
    createPipelineWebhookSchema,

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/cuongdev/mcp-codepipeline-server'

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