approve_action
Approve or reject manual approval actions in AWS CodePipeline stages to control pipeline progression and manage deployment workflows.
Instructions
Approve or reject a manual approval action
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pipelineName | Yes | Name of the pipeline | |
| stageName | Yes | Name of the stage | |
| actionName | Yes | Name of the action | |
| token | Yes | Approval token | |
| approved | Yes | Boolean indicating approval or rejection | |
| comments | No | Optional comments |
Implementation Reference
- src/tools/approve_action.ts:38-73 (handler)The async handler function that implements the core logic of approving or rejecting a CodePipeline manual approval action by calling putApprovalResult.export async function approveAction( codePipelineManager: CodePipelineManager, input: { pipelineName: string; stageName: string; actionName: string; token: string; approved: boolean; comments?: string; } ) { const { pipelineName, stageName, actionName, token, approved, comments } = input; const codepipeline = codePipelineManager.getCodePipeline(); await codepipeline.putApprovalResult({ pipelineName, stageName, actionName, token, result: { status: approved ? 'Approved' : 'Rejected', summary: comments || '' } }).promise(); return { content: [ { type: "text", text: JSON.stringify({ message: `Action ${approved ? 'approved' : 'rejected'} successfully` }, null, 2), }, ], }; }
- src/tools/approve_action.ts:3-36 (schema)The input schema definition for the approve_action tool, including parameters and requirements.export const approveActionSchema = { name: "approve_action", description: "Approve or reject a manual approval action", inputSchema: { type: "object", properties: { pipelineName: { type: "string", description: "Name of the pipeline" }, stageName: { type: "string", description: "Name of the stage" }, actionName: { type: "string", description: "Name of the action" }, token: { type: "string", description: "Approval token" }, approved: { type: "boolean", description: "Boolean indicating approval or rejection" }, comments: { type: "string", description: "Optional comments" } }, required: ["pipelineName", "stageName", "actionName", "token", "approved"], }, } as const;
- src/index.ts:148-157 (registration)The dispatch/registration of the approve_action handler in the MCP CallToolRequestHandler switch statement.case "approve_action": { return await approveAction(codePipelineManager, input as { pipelineName: string; stageName: string; actionName: string; token: string; approved: boolean; comments?: string; }); }
- src/index.ts:110-128 (registration)Registration of the approve_action schema (line 116) in the MCP ListToolsRequestHandler.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ listPipelinesSchema, getPipelineStateSchema, listPipelineExecutionsSchema, approveActionSchema, retryStageSchema, triggerPipelineSchema, getPipelineExecutionLogsSchema, stopPipelineExecutionSchema, // Add new tool schemas getPipelineDetailsSchema, tagPipelineResourceSchema, createPipelineWebhookSchema, getPipelineMetricsSchema, ], }; });
- src/index.ts:24-27 (registration)Import of the approveAction handler and approveActionSchema for registration in the main MCP server.import { approveAction, approveActionSchema } from "./tools/approve_action.js";