get_pipeline_execution_logs
Retrieve execution logs for a specific pipeline by providing the pipeline name and execution ID using AWS CodePipeline MCP Server.
Instructions
Get logs for a pipeline execution
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| executionId | Yes | Execution ID | |
| pipelineName | Yes | Name of the pipeline |
Input Schema (JSON Schema)
{
"properties": {
"executionId": {
"description": "Execution ID",
"type": "string"
},
"pipelineName": {
"description": "Name of the pipeline",
"type": "string"
}
},
"required": [
"pipelineName",
"executionId"
],
"type": "object"
}
Implementation Reference
- The handler function that implements the tool logic: fetches pipeline execution details using AWS CodePipeline SDK and returns formatted logs as text content.export async function getPipelineExecutionLogs( codePipelineManager: CodePipelineManager, input: { pipelineName: string; executionId: string; } ) { const { pipelineName, executionId } = input; const codepipeline = codePipelineManager.getCodePipeline(); const response = await codepipeline.getPipelineExecution({ pipelineName, pipelineExecutionId: executionId }).promise(); // Format the response for better readability // Extract and format the execution details const logs = { pipelineName: response.pipelineExecution?.pipelineName || pipelineName, pipelineVersion: response.pipelineExecution?.pipelineVersion || '1', pipelineExecution: { pipelineExecutionId: response.pipelineExecution?.pipelineExecutionId, status: response.pipelineExecution?.status, artifactRevisions: response.pipelineExecution?.artifactRevisions?.map((revision: AWS.CodePipeline.ArtifactRevision) => ({ name: revision.name, revisionId: revision.revisionId, revisionSummary: revision.revisionSummary, revisionUrl: revision.revisionUrl })) } }; return { content: [ { type: "text", text: JSON.stringify({ logs }, null, 2), }, ], }; }
- The schema defining the tool name, description, and input parameters (pipelineName and executionId).export const getPipelineExecutionLogsSchema = { name: "get_pipeline_execution_logs", description: "Get logs for a pipeline execution", inputSchema: { type: "object", properties: { pipelineName: { type: "string", description: "Name of the pipeline" }, executionId: { type: "string", description: "Execution ID" } }, required: ["pipelineName", "executionId"], }, } as const;
- src/index.ts:39-42 (registration)Import of the tool handler and schema.import { getPipelineExecutionLogs, getPipelineExecutionLogsSchema } from "./tools/get_pipeline_execution_logs.js";
- src/index.ts:110-128 (registration)Registration of the tool schema in the MCP listTools request handler.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:173-178 (registration)Tool handler dispatch in the MCP callTool request handler switch statement.case "get_pipeline_execution_logs": { return await getPipelineExecutionLogs(codePipelineManager, input as { pipelineName: string; executionId: string; }); }