Skip to main content
Glama
AgentWong
by AgentWong

get_terraform_provider_info

Retrieve comprehensive information about Terraform providers to support Infrastructure-as-Code development, including version tracking and relationship mapping.

Instructions

Retrieve comprehensive information about a Terraform provider

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
provider_nameYesName of the Terraform provider

Implementation Reference

  • The MCP tool handler function that executes the get_terraform_provider_info logic by calling the database helper and formatting the output as text content.
    async def handle_get_terraform_provider_info(
        db: Any, arguments: Dict[str, Any], operation_id: str
    ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        """Handle get_terraform_provider_info tool."""
        try:
            logger.info(
                "Getting Terraform provider info",
                extra={
                    "provider_name": arguments["provider_name"],
                    "operation_id": operation_id,
                },
            )
    
            # Get provider info
            provider = get_terraform_provider_info(db, arguments["provider_name"])
    
            # Format output string
            info_str = f"""Provider: {provider['name']}
                        Version: {provider['version']}
                        Source: {provider['source_url']}
                        Documentation: {provider['doc_url']}
                        Supported Resources:"""
    
            for resource in provider["resources"]:
                info_str += f"\n- {resource['name']} ({resource['type']})"
                info_str += f"\n  Version: {resource['version']}"
    
            return [types.TextContent(type="text", text=info_str)]
    
        except Exception as e:
            error_msg = f"Failed to get provider info: {str(e)}"
            logger.error(error_msg, extra={"operation_id": operation_id})
            return [types.TextContent(type="text", text=error_msg)]
  • JSON schema defining the input parameters for the get_terraform_provider_info tool, requiring 'provider_name'.
    "get_terraform_provider_info": {
        "type": "object",
        "description": "Retrieve comprehensive information about a Terraform provider",
        "required": ["provider_name"],
        "properties": {
            "provider_name": {
                "type": "string",
                "description": "Name of the Terraform provider",
            }
        },
    },
  • Registration mapping the 'get_terraform_provider_info' tool name to its handler function within the terraform tool handlers dictionary.
    terraform_tool_handlers = {
        "get_terraform_provider_info": handle_get_terraform_provider_info,
        "list_provider_resources": handle_list_provider_resources,
        "get_terraform_resource_info": handle_get_terraform_resource_info,
        "add_terraform_provider": handle_add_terraform_provider,
        "add_terraform_resource": handle_add_terraform_resource,
        "update_provider_version": handle_update_provider_version,
    }
  • Helper function that queries the database for Terraform provider details, including associated resources, used by the tool handler.
    def get_terraform_provider_info(db: DatabaseManager, provider_name: str) -> Dict:
        """Get comprehensive information about a Terraform provider.
        
        Args:
            db: Database manager instance
            provider_name: Name of the provider to retrieve
            
        Returns:
            Dictionary containing provider information including metadata and resource count
        """
        logger.info(
            "Getting Terraform provider info",
            extra={
                "provider_name": provider_name,
                "operation": "get_terraform_provider_info"
            }
        )
        
        try:
            with db.get_connection() as conn:
                conn.execute("PRAGMA busy_timeout = 5000")  # 5 second timeout
                
                # Get provider info with resource count
                result = conn.execute(
                    """
                    SELECT
                        p.id,
                        p.name,
                        p.version,
                        p.source_url,
                        p.doc_url,
                        p.updated_at,
                        COUNT(r.id) as resource_count,
                        MAX(r.updated_at) as latest_resource_update
                    FROM terraform_providers p
                    LEFT JOIN terraform_resources r ON p.id = r.provider_id
                    WHERE p.name = ?
                    GROUP BY p.id, p.name, p.version, p.source_url, p.doc_url, p.updated_at
                    """,
                    (provider_name,)
                ).fetchone()
                
                if not result:
                    raise DatabaseError(f"Provider '{provider_name}' not found")
                    
                # Convert row to dict and ensure all necessary fields are present
                provider_info = {
                    "id": result["id"],
                    "name": result["name"],
                    "version": result["version"],
                    "source_url": result["source_url"],
                    "doc_url": result["doc_url"],
                    "updated_at": result["updated_at"],
                    "resource_count": result["resource_count"],
                    "latest_resource_update": result["latest_resource_update"]
                }
                
                # Get resources associated with this provider
                resources = conn.execute(
                    """
                    SELECT name, resource_type, version, doc_url
                    FROM terraform_resources
                    WHERE provider_id = ?
                    ORDER BY updated_at DESC
                    """,
                    (provider_info["id"],)
                ).fetchall()
                
                # Convert resource rows to dicts with explicit field mapping
                provider_info["resources"] = [
                    {
                        "name": r["name"],
                        "type": r["resource_type"],
                        "version": r["version"],
                        "doc_url": r["doc_url"]
                    } for r in resources
                ]
                
                return provider_info
                
        except sqlite3.Error as e:
            error_msg = f"Failed to get provider info: {str(e)}"
            logger.error(error_msg)
            raise DatabaseError(error_msg)
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states it 'retrieves' information, implying a read-only operation, but doesn't disclose behavioral traits like authentication needs, rate limits, error handling, or what 'comprehensive information' entails. This leaves significant gaps for a tool with no annotation coverage.

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 front-loads the core purpose without unnecessary words. Every part of the sentence earns its place by specifying the action and resource clearly.

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 the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'comprehensive information' includes, how results are formatted, or any behavioral context, which is inadequate for a tool that likely returns complex data about Terraform providers.

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%, with the parameter 'provider_name' fully documented in the schema. The description adds no additional meaning beyond what the schema provides, such as examples or constraints, so it meets the baseline for high schema coverage without compensating value.

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 ('Retrieve comprehensive information') and resource ('about a Terraform provider'), making the purpose unambiguous. However, it doesn't differentiate from sibling tools like 'get_terraform_resource_info' or 'get_provider_version_history', which limits its score.

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. With siblings like 'get_provider_version_history' and 'list_terraform_providers' available, there's no indication of context, prerequisites, or exclusions for this specific retrieval tool.

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/AgentWong/iac-memory-mcp-server-project'

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