tag_pipeline_resource
Add or update tags on AWS CodePipeline resources to organize, track, and manage pipelines efficiently. Specify pipeline name and tag key-value pairs for precise resource identification.
Instructions
Add or update tags for a pipeline resource
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pipelineName | Yes | Name of the pipeline | |
| tags | Yes | List of tags to add or update |
Implementation Reference
- src/tools/tag_pipeline_resource.ts:36-75 (handler)The main handler function that executes the tool: retrieves pipeline ARN and applies tags using AWS CodePipeline SDK, returning success message.export async function tagPipelineResource( codePipelineManager: CodePipelineManager, input: { pipelineName: string; tags: Array<{ key: string; value: string }>; } ) { const { pipelineName, tags } = input; const codepipeline = codePipelineManager.getCodePipeline(); // First, get the pipeline ARN const pipelineResponse = await codepipeline.getPipeline({ name: pipelineName }).promise(); const resourceArn = pipelineResponse.metadata?.pipelineArn; if (!resourceArn) { throw new Error(`Could not find ARN for pipeline: ${pipelineName}`); } // Tag the resource await codepipeline.tagResource({ resourceArn, tags: tags.map(tag => ({ key: tag.key, value: tag.value })) }).promise(); return { content: [ { type: "text", text: JSON.stringify({ message: "Pipeline resource tagged successfully", resourceArn, tags }, null, 2), }, ], }; }
- The input schema and metadata for the tag_pipeline_resource tool, defining parameters pipelineName and tags array.export const tagPipelineResourceSchema = { name: "tag_pipeline_resource", description: "Add or update tags for a pipeline resource", inputSchema: { type: "object", properties: { pipelineName: { type: "string", description: "Name of the pipeline" }, tags: { type: "array", description: "List of tags to add or update", items: { type: "object", properties: { key: { type: "string", description: "Tag key" }, value: { type: "string", description: "Tag value" } }, required: ["key", "value"] } } }, required: ["pipelineName", "tags"], }, } as const;
- src/index.ts:195-200 (registration)Tool handler registration in the switch statement of the CallToolRequestHandler.case "tag_pipeline_resource": { return await tagPipelineResource(codePipelineManager, input as { pipelineName: string; tags: Array<{ key: string; value: string }>; }); }
- src/index.ts:56-58 (registration)Import of the tool handler and schema into the main index file.tagPipelineResource, tagPipelineResourceSchema } from "./tools/tag_pipeline_resource.js";
- src/index.ts:123-123 (registration)Inclusion of the tool schema in the list of available tools returned by ListToolsRequestHandler.tagPipelineResourceSchema,