Skip to main content
Glama
pulumi
by pulumi

pulumi-cli-preview

Executes Pulumi preview to analyze infrastructure changes in a specified project and stack, ensuring configurations are updated correctly before deployment.

Instructions

Run pulumi preview for a given project and stack

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stackNameNoThe associated stack name. Defaults to 'dev'.
workDirYesThe working directory of the program.

Implementation Reference

  • Executes Pulumi preview using the automation API, formats and returns the change summary and stdout.
    handler: async (args: PreviewArgs) => { const stackArgs: automation.LocalProgramArgs = { stackName: args.stackName ?? 'dev', workDir: args.workDir }; const stack = await automation.LocalWorkspace.createOrSelectStack(stackArgs); // Run preview const previewResult = await stack.preview({ diff: true }); // Format the changes const changes = previewResult.changeSummary; const changesSummary = [ `Create: ${changes.create}`, `Update: ${changes.update}`, `Delete: ${changes.delete}`, `Same: ${changes.same}` ].join('\n'); return { description: 'Pulumi Preview Results', content: [ { type: 'text' as const, text: ` Preview Results for stack: ${stack.name} Changes: ${changesSummary} ${previewResult.stdout || 'No additional output'} ` } ] }; }
  • Input schema using Zod for workDir (required) and stackName (optional, defaults to 'dev').
    schema: { workDir: z.string().describe('The working directory of the program.'), stackName: z.string().optional().describe("The associated stack name. Defaults to 'dev'.") },
  • Registers all Pulumi CLI commands, including 'preview' as 'pulumi-cli-preview', in the MCP server with error handling.
    Object.entries(cliCommands).forEach(([commandName, command]) => { const toolName = `pulumi-cli-${commandName}`; // eslint-disable-next-line @typescript-eslint/no-explicit-any this.tool(toolName, command.description, command.schema, async (args: any) => { try { return await command.handler(args); } catch (error) { return handleError(error, toolName); } }); });

Other Tools

Related 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/pulumi/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server