Skip to main content
Glama
opentofu

OpenTofu MCP Server

Official
by opentofu

get-module-details

Retrieve detailed information about a specific OpenTofu module by providing its namespace, name, and target platform to access module specifications and configurations.

Instructions

Get detailed information about a specific OpenTofu module by namespace, name, and target. Use the simple module name, NOT the full repository name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namespaceYesModule namespace without prefix (e.g., 'terraform-aws-modules')
nameYesSimple module name WITHOUT 'terraform-aws-' or similar prefix (e.g., 'vpc', 's3-bucket')
targetYesModule target platform (e.g., 'aws', 'kubernetes', 'azurerm')

Implementation Reference

  • MCP tool handler for 'get-module-details': fetches details using RegistryClient, renders with renderModuleDetails, handles errors.
    async (params) => {
      try {
        const module = await client.getModuleDetails(params.namespace, params.name, params.target);
        return textResult(renderModuleDetails(module));
      } catch (error: unknown) {
        const errorMessage = error instanceof Error ? error.message : "Module not found";
        return textResult(`Failed to get details for module ${params.namespace}/${params.name} (${params.target}): ${errorMessage}`);
      }
    },
  • Zod input schema defining parameters for get-module-details tool: namespace, name, target.
    const moduleDetailsSchema = {
      namespace: z.string().min(1).describe("Module namespace without prefix (e.g., 'terraform-aws-modules')"),
      name: z.string().min(1).describe("Simple module name WITHOUT 'terraform-aws-' or similar prefix (e.g., 'vpc', 's3-bucket')"),
      target: z.string().min(1).describe("Module target platform (e.g., 'aws', 'kubernetes', 'azurerm')"),
    };
  • Registration of the 'get-module-details' MCP tool via server.tool with description, schema, and handler.
    server.tool(
      "get-module-details",
      "Get detailed information about a specific OpenTofu module by namespace, name, and target. Use the simple module name, NOT the full repository name.",
      moduleDetailsSchema,
      async (params) => {
        try {
          const module = await client.getModuleDetails(params.namespace, params.name, params.target);
          return textResult(renderModuleDetails(module));
        } catch (error: unknown) {
          const errorMessage = error instanceof Error ? error.message : "Module not found";
          return textResult(`Failed to get details for module ${params.namespace}/${params.name} (${params.target}): ${errorMessage}`);
        }
      },
    );
  • RegistryClient.getModuleDetails: Fetches the module JSON from OpenTofu Registry API endpoint.
    async getModuleDetails(namespace: string, name: string, target: string): Promise<apiDefinition["Module"]> {
      const path = `/registry/docs/modules/${namespace}/${name}/${target}/index.json`;
      return await this.fetchFromApi<apiDefinition["Module"]>(path);
    }
  • renderModuleDetails: Formats the fetched module data into a human-readable markdown string.
    export function renderModuleDetails(module: apiDefinition["Module"]): string {
      return `## Module: ${module.addr.display}\n
    ${module.description}
    
    **Available Versions**: ${module.versions.map((v) => v.id).join(", ")}
    
    **Popularity Score**: ${module.popularity}
    ${module.fork_of ? `\n**Forked from**: ${module.fork_of.display}\n` : ""}${module.fork_count > 0 ? `\n**Fork count**: ${module.fork_count}\n` : ""}`;
    }
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 mentions the naming convention but doesn't describe what 'detailed information' includes, potential errors, authentication needs, rate limits, or response format. For a read operation with no annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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 extremely concise with two sentences that are front-loaded and waste no words. The first sentence states the purpose, and the second provides a critical usage note, making it efficient and well-structured for quick understanding.

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 for a tool with three parameters. It doesn't explain what 'detailed information' entails, potential outputs, or error conditions. While the schema covers parameters well, the overall context for using the tool effectively is lacking, especially for behavioral aspects.

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%, so the schema fully documents the three parameters (namespace, name, target) with clear descriptions. The description adds minimal value by reinforcing the naming rule for 'name' but doesn't provide additional semantic context beyond what's in the schema. This meets the baseline for high schema coverage.

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 ('Get detailed information') and the resource ('a specific OpenTofu module'), making the purpose understandable. It distinguishes itself from siblings by focusing on module details rather than datasources, providers, resources, or registry searches. However, it doesn't explicitly contrast with 'search-opentofu-registry' for when to use one versus the other.

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

Usage Guidelines3/5

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

The description provides some guidance by specifying to 'use the simple module name, NOT the full repository name,' which helps avoid misuse. However, it lacks explicit when-to-use instructions compared to siblings like 'search-opentofu-registry' or alternatives for different data types. The context is implied but not comprehensive.

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

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