get_pipeline_execution_logs
Retrieve execution logs for AWS CodePipeline to monitor pipeline runs and troubleshoot issues by specifying pipeline name and execution ID.
Instructions
Get logs for a pipeline execution
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pipelineName | Yes | Name of the pipeline | |
| executionId | Yes | Execution ID |
Implementation Reference
- The main handler function for the 'get_pipeline_execution_logs' MCP tool. Fetches pipeline execution details from AWS CodePipeline via CodePipelineManager and formats the response as MCP 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 definition for the 'get_pipeline_execution_logs' tool, including name, description, and input schema validation.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:173-178 (registration)Registration and dispatch handler in the MCP server's CallToolRequest handler switch statement, which calls the tool handler function.case "get_pipeline_execution_logs": { return await getPipelineExecutionLogs(codePipelineManager, input as { pipelineName: string; executionId: string; }); }
- src/index.ts:119-119 (registration)Registration of the tool schema in the ListToolsRequest handler response.getPipelineExecutionLogsSchema,
- src/index.ts:40-42 (registration)Import statement registering the handler and schema for use in the MCP server.getPipelineExecutionLogs, getPipelineExecutionLogsSchema } from "./tools/get_pipeline_execution_logs.js";