Skip to main content
Glama
pulumi

@pulumi/mcp-server

Official
by pulumi

pulumi-registry-list-resources

Retrieve all resource types for a specific cloud provider or Git-hosted module, with optional filtering by module name, to simplify resource discovery and management.

Instructions

List all resource types for a given provider and module

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
moduleNoOptional module to filter by (e.g., 's3', 'ec2', 'lambda')
providerYesThe cloud provider (e.g., 'aws', 'azure', 'gcp', 'random') or github.com/org/repo for Git-hosted components

Implementation Reference

  • Handler function for the 'list-resources' command that fetches the provider schema using 'pulumi package get-schema', filters resources by optional module, formats them with type, name, module, and short description, and returns as JSON or error message if none found.
    handler: async (args: ListResourcesArgs) => {
      const schema = await getSchema(args.provider, args.version);
    
      // Filter and format resources
      const resources = Object.entries(schema.resources)
        .filter(([key]) => {
          if (args.module) {
            const [, modulePath] = key.split(':');
            const mainModule = modulePath.split('/')[0];
            return mainModule === args.module;
          }
          return true;
        })
        .map(([key, resource]) => {
          const resourceName = key.split(':').pop() || '';
          const modulePath = key.split(':')[1];
          const mainModule = modulePath.split('/')[0];
          // Trim description at first '#' character
          const shortDescription =
            resource.description?.split('\n')[0].trim() ?? '<no description>';
          return {
            type: key,
            name: resourceName,
            module: mainModule,
            description: shortDescription
          };
        });
    
      if (resources.length === 0) {
        return {
          description: 'No resources found',
          content: [
            {
              type: 'text' as const,
              text: args.module
                ? `No resources found for provider '${args.provider}' in module '${args.module}'`
                : `No resources found for provider '${args.provider}'`
            }
          ]
        };
      }
    
      return {
        description: 'Lists available Pulumi Registry resources',
        content: [
          {
            type: 'text' as const,
            text: JSON.stringify(resources)
          }
        ]
      };
    }
  • Definition of the 'list-resources' command including description and Zod input schema for provider (required string), module (optional string), version (optional string).
    'list-resources': {
      description: 'List all resource types for a given provider and module',
      schema: {
        provider: z
          .string()
          .describe(
            "The cloud provider (e.g., 'aws', 'azure', 'gcp', 'random') or github.com/org/repo for Git-hosted components"
          ),
        module: z
          .string()
          .optional()
          .describe("Optional module to filter by (e.g., 's3', 'ec2', 'lambda')"),
        version: z
          .string()
          .optional()
          .describe(
            "The provider version to use (e.g., '6.0.0'). If not specified, uses the latest available version."
          )
      },
  • Code that registers all registry commands (including 'list-resources') as MCP tools with prefixed names like 'pulumi-registry-list-resources', using the command's description, schema, and handler wrapped in try-catch error handling.
    // Register registry commands
    Object.entries(registryCommands(CACHE_DIR)).forEach(([commandName, command]) => {
      const toolName = `pulumi-registry-${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);
        }
      });
    });
  • Helper function to retrieve and cache the Pulumi provider schema by executing 'pulumi package get-schema' CLI command if not cached.
    async function getSchema(provider: string, version?: string): Promise<Schema> {
      const providerWithVersion = version ? `${provider}@${version}` : provider;
      const cacheFile = path.join(
        cacheDir,
        `${providerWithVersion.replace(/[^a-zA-Z0-9]/g, '_')}_schema.json`
      );
    
      if (!fs.existsSync(cacheFile)) {
        const output = execFileSync('pulumi', ['package', 'get-schema', providerWithVersion], {
          maxBuffer: 50 * 1024 * 1024 // 50MB buffer instead of default 1MB (AWS provider schema is ~37MB)
        });
        fs.writeFileSync(cacheFile, output);
      }
      return JSON.parse(fs.readFileSync(cacheFile, 'utf-8'));
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool lists resources but lacks details on permissions, rate limits, pagination, or output format. For a read operation without annotations, this is insufficient to inform the agent about how the tool behaves beyond its basic function.

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, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy for an agent to parse quickly. This exemplifies optimal conciseness for a simple tool.

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

Completeness3/5

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

Given the tool's low complexity (2 parameters, no output schema, no annotations), the description adequately covers the basic purpose. However, it lacks details on output format, error handling, or usage context, which could be helpful for an agent. It meets minimum viability but has clear gaps in completeness for operational use.

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?

The input schema has 100% description coverage, clearly documenting both parameters. The description adds minimal value by mentioning 'provider and module' but doesn't elaborate on semantics beyond what the schema provides. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't significantly enhance parameter understanding.

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

Purpose4/5

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

The description clearly states the action ('List') and target ('all resource types'), specifying the scope ('for a given provider and module'). It distinguishes from sibling tools like 'pulumi-registry-get-resource' by focusing on listing rather than retrieving details, but doesn't explicitly contrast with other siblings like CLI tools. This makes it clear but not fully differentiated from all alternatives.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention scenarios for listing resources, prerequisites, or exclusions, and offers no comparison with sibling tools like 'pulumi-cli-preview' or 'pulumi-registry-get-resource'. This leaves the agent without context for tool selection.

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

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