Skip to main content
Glama
cuongdev

AWS CodePipeline MCP Server

by cuongdev

get_pipeline_state

Retrieve the current status and execution details of an AWS CodePipeline to monitor deployment progress and identify issues.

Instructions

Get the state of a specific pipeline

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pipelineNameYesName of the pipeline

Implementation Reference

  • The handler function that fetches the AWS CodePipeline state for the given pipelineName, transforms the response data, and returns it as MCP content.
    export async function getPipelineState(codePipelineManager: CodePipelineManager, input: { pipelineName: string }) {
      const { pipelineName } = input;
      const codepipeline = codePipelineManager.getCodePipeline();
      
      const response = await codepipeline.getPipelineState({ name: pipelineName }).promise();
      
      // Convert AWS.CodePipeline.StageState[] to our StageState[]
      const stageStates = response.stageStates?.map((stage: AWS.CodePipeline.StageState) => {
        // Convert TransitionState
        const inboundTransitionState = stage.inboundTransitionState ? {
          enabled: stage.inboundTransitionState.enabled === undefined ? false : stage.inboundTransitionState.enabled,
          lastChangedBy: stage.inboundTransitionState.lastChangedBy,
          lastChangedAt: stage.inboundTransitionState.lastChangedAt,
          disabledReason: stage.inboundTransitionState.disabledReason
        } : undefined;
        
        // Convert StageExecution
        const latestExecution = stage.latestExecution ? {
          pipelineExecutionId: stage.latestExecution.pipelineExecutionId || '',
          status: stage.latestExecution.status || ''
        } : undefined;
        
        // Convert ActionStates
        const actionStates = (stage.actionStates || []).map((action: AWS.CodePipeline.ActionState) => {
          // Convert ActionExecution
          const latestExecution = action.latestExecution ? {
            status: action.latestExecution.status || '',
            summary: action.latestExecution.summary,
            lastStatusChange: action.latestExecution.lastStatusChange || new Date().toISOString(),
            token: action.latestExecution.token,
            externalExecutionId: action.latestExecution.externalExecutionId,
            externalExecutionUrl: action.latestExecution.externalExecutionUrl,
            errorDetails: action.latestExecution.errorDetails ? {
              code: action.latestExecution.errorDetails.code || '',
              message: action.latestExecution.errorDetails.message || ''
            } : undefined
          } : undefined;
          
          // Convert ActionRevision
          const currentRevision = action.currentRevision ? {
            revisionId: action.currentRevision.revisionId || '',
            revisionChangeId: action.currentRevision.revisionChangeId || '',
            created: action.currentRevision.created || new Date().toISOString()
          } : undefined;
          
          return {
            actionName: action.actionName || '',
            currentRevision,
            latestExecution,
            entityUrl: action.entityUrl
          };
        });
        
        return {
          stageName: stage.stageName || '',
          inboundTransitionState,
          actionStates,
          latestExecution
        };
      }) || [];
      
      const pipelineState = {
        pipelineName: response.pipelineName || '',
        pipelineVersion: response.pipelineVersion || 0,
        stageStates: stageStates,
        created: response.created?.toISOString() || '',
        updated: response.updated?.toISOString() || ''
      };
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({ pipelineState }, null, 2),
          },
        ],
      };
    }
  • Schema definition for the get_pipeline_state tool, including name, description, and input schema requiring pipelineName.
    export const getPipelineStateSchema = {
      name: "get_pipeline_state",
      description: "Get the state of a specific pipeline",
      inputSchema: {
        type: "object",
        properties: {
          pipelineName: { 
            type: "string",
            description: "Name of the pipeline"
          }
        },
        required: ["pipelineName"],
      },
    } as const;
  • src/index.ts:110-128 (registration)
    Registration of the tool schema in the MCP server's 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:140-142 (registration)
    Dispatch/registration of the tool handler in the MCP server's callTool request handler switch statement.
    case "get_pipeline_state": {
      return await getPipelineState(codePipelineManager, input as { pipelineName: string });
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states the action without any details on permissions, rate limits, error conditions, or what the return value includes (e.g., status, timestamps, errors). This is inadequate for a tool that likely returns operational data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence with no wasted words. It is front-loaded and efficiently conveys the core purpose, though it lacks depth due to its brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete. It doesn't explain what 'state' entails (e.g., running, failed, paused) or provide any context on the response structure, which is critical for an agent to use this tool effectively in a pipeline management system.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the parameter 'pipelineName' clearly documented in the schema. The description adds no additional meaning beyond the schema, such as format examples or constraints, but the schema provides sufficient baseline information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the action ('Get') and target ('state of a specific pipeline'), which is clear but basic. It doesn't differentiate from siblings like 'get_pipeline_details' or 'get_pipeline_metrics', leaving ambiguity about what 'state' specifically refers to versus other pipeline attributes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'get_pipeline_details' and 'get_pipeline_metrics', the description lacks any context on how 'state' differs from 'details' or 'metrics', leaving the agent to guess based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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