approve_action
Manually approve or reject pipeline actions in AWS CodePipeline by specifying pipeline, stage, action, token, and decision. Optional comments can be included for clarity.
Instructions
Approve or reject a manual approval action
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| actionName | Yes | Name of the action | |
| approved | Yes | Boolean indicating approval or rejection | |
| comments | No | Optional comments | |
| pipelineName | Yes | Name of the pipeline | |
| stageName | Yes | Name of the stage | |
| token | Yes | Approval token |
Input Schema (JSON Schema)
{
"properties": {
"actionName": {
"description": "Name of the action",
"type": "string"
},
"approved": {
"description": "Boolean indicating approval or rejection",
"type": "boolean"
},
"comments": {
"description": "Optional comments",
"type": "string"
},
"pipelineName": {
"description": "Name of the pipeline",
"type": "string"
},
"stageName": {
"description": "Name of the stage",
"type": "string"
},
"token": {
"description": "Approval token",
"type": "string"
}
},
"required": [
"pipelineName",
"stageName",
"actionName",
"token",
"approved"
],
"type": "object"
}
Implementation Reference
- src/tools/approve_action.ts:38-73 (handler)The main handler function that executes the approve_action MCP tool. It calls AWS CodePipeline's putApprovalResult to approve or reject the action and returns a formatted response.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 schema definition for the approve_action tool, specifying input parameters and validation.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)Registration of the approve_action tool 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 tool schema in the MCP ListToolsRequestHandler, listing it among available tools.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 from the tools directory.import { approveAction, approveActionSchema } from "./tools/approve_action.js";