Skip to main content
Glama
opentofu

OpenTofu MCP Server

Official
by opentofu

get-provider-details

Retrieve detailed information about OpenTofu providers by specifying namespace and name to understand capabilities and requirements.

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
namespaceYesProvider namespace (e.g., 'hashicorp', 'opentofu')
nameYesProvider name WITHOUT 'terraform-provider-' prefix (e.g., 'aws', 'kubernetes', 'azurerm')

Implementation Reference

  • MCP tool handler: fetches provider details using RegistryClient, renders with renderProviderDetails, handles errors.
    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}`);
      }
    },
  • Input schema defining namespace and name parameters with Zod validation and descriptions.
    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')"),
    };
  • Registers the 'get-provider-details' tool with MCP server, providing name, description, schema, and handler.
    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}`);
        }
      },
    );
  • RegistryClient method implementing the core logic: fetches provider index, determines and fetches latest version details from OpenTofu 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 format and render the provider details into markdown text 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;
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses a key behavioral constraint about the name parameter prefix, which is valuable. However, it doesn't mention other traits like whether this is a read-only operation, potential rate limits, error handling, or what 'detailed information' includes beyond the schema.

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 two sentences with zero waste: the first states the purpose, and the second provides essential usage guidance. It's appropriately sized and front-loaded with the core functionality.

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 moderate complexity (2 required parameters, no output schema, no annotations), the description is adequate but has gaps. It covers the purpose and a key parameter constraint well, but lacks details on behavioral traits (e.g., read-only nature, error cases) and output format, which would help the agent use it correctly.

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 already documents both parameters thoroughly. The description adds the critical semantic note about excluding the 'terraform-provider-' prefix for the name parameter, which compensates slightly. However, it doesn't provide additional meaning beyond what's in the schema descriptions.

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

Purpose5/5

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

The description clearly states the verb ('Get detailed information') and resource ('about a specific OpenTofu provider by namespace and name'), making the purpose specific and actionable. It distinguishes from siblings by focusing on provider details rather than docs, modules, or search.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool (to get provider details) and includes an important exclusion ('Do NOT include 'terraform-provider-' prefix'), which helps avoid misuse. However, it doesn't explicitly mention when to use alternatives like search-opentofu-registry for broader queries.

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