Skip to main content
Glama
opentofu

OpenTofu MCP Server

Official
by opentofu

get-provider-details

Retrieve comprehensive details about an OpenTofu provider by specifying its namespace and name. Exclude the 'terraform-provider-' prefix to ensure accurate results.

Instructions

Get detailed information about a specific OpenTofu provider by namespace and name. Do NOT include 'terraform-provider-' prefix in the name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesProvider name WITHOUT 'terraform-provider-' prefix (e.g., 'aws', 'kubernetes', 'azurerm')
namespaceYesProvider namespace (e.g., 'hashicorp', 'opentofu')

Implementation Reference

  • Registration of the MCP tool 'get-provider-details' including its inline handler function that delegates to RegistryClient and rendering.
    server.tool( "get-provider-details", "Get detailed information about a specific OpenTofu provider by namespace and name. Do NOT include 'terraform-provider-' prefix in the name.", providerDetailsSchema, async (params) => { try { const provider = await client.getProviderDetails(params.namespace, params.name); return textResult(renderProviderDetails(params.name, params.namespace, provider)); } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : "Provider not found"; return textResult(`Failed to get details for provider ${params.namespace}/${params.name}: ${errorMessage}`); } }, );
  • Zod schema for input parameters of the get-provider-details tool: namespace and name.
    const providerDetailsSchema = { namespace: z.string().min(1).describe("Provider namespace (e.g., 'hashicorp', 'opentofu')"), name: z.string().min(1).describe("Provider name WITHOUT 'terraform-provider-' prefix (e.g., 'aws', 'kubernetes', 'azurerm')"), };
  • Core implementation in RegistryClient that fetches provider details and latest version from the OpenTofu Registry API.
    async getProviderDetails(namespace: string, name: string): Promise<ProviderWithLatestVersion> { const path = `/registry/docs/providers/${namespace}/${name}/index.json`; const provider = await this.fetchFromApi<apiDefinition["Provider"]>(path); const enhancedProvider: ProviderWithLatestVersion = { ...provider }; if (provider.versions?.length > 0) { const latestVersion = this.getLatestVersion(provider.versions); const versionPath = `/registry/docs/providers/${namespace}/${name}/${latestVersion}/index.json`; const versionDetails = await this.fetchFromApi<apiDefinition["ProviderVersion"]>(versionPath); enhancedProvider.latestVersion = versionDetails; } return enhancedProvider; }
  • Helper function to render the provider details into a formatted markdown string for the tool response.
    export function renderProviderDetails(name: string, namespace: string, provider: ProviderWithLatestVersion): string { let formattedResponse = `## Provider: ${provider.addr.display}\n ${provider.description} **Latest Version**: ${provider.versions[0]?.id || "Unknown"} **All Versions**: ${provider.versions.map((v) => v.id).join(", ")} **Popularity Score**: ${provider.popularity} ${provider.link ? `\n**Documentation**: ${provider.link}\n` : ""}`; if (provider.latestVersion) { const v = provider.latestVersion; formattedResponse += `\n## Latest Version Details (${v.id})\n`; if (v.docs?.resources) { formattedResponse += `\n${renderResourcesSection(v.docs.resources, name, namespace)}\n`; } if (v.docs?.datasources) { formattedResponse += `\n${renderDataSourcesSection(v.docs.datasources, name, namespace)}\n`; } } return formattedResponse; }

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

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