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
| Name | Required | Description | Default |
|---|---|---|---|
| namespace | Yes | Module namespace without prefix (e.g., 'terraform-aws-modules') | |
| name | Yes | Simple module name WITHOUT 'terraform-aws-' or similar prefix (e.g., 'vpc', 's3-bucket') | |
| target | Yes | Module target platform (e.g., 'aws', 'kubernetes', 'azurerm') |
Implementation Reference
- src/servers/registry/index.ts:106-114 (handler)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}`); } },
- src/servers/registry/index.ts:17-21 (schema)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')"), };
- src/servers/registry/index.ts:102-115 (registration)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}`); } }, );
- src/registry/index.ts:113-116 (helper)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); }
- src/servers/registry/render.ts:31-39 (helper)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` : ""}`; }