Skip to main content
Glama
AgentWong

IAC Memory MCP Server

by AgentWong

get_terraform_provider_info

Retrieve comprehensive information about Terraform providers to support Infrastructure-as-Code management and decision-making.

Instructions

Retrieve comprehensive information about a Terraform provider

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
provider_nameYesName of the Terraform provider

Implementation Reference

  • MCP tool handler function that retrieves Terraform provider information from the database and formats it 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.
    "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 of the tool handler in 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,
        "update_resource_schema": handle_update_resource_schema,
    }
  • Database helper function that queries the database for Terraform provider information and associated resources.
    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?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves information, implying a read-only operation, but fails to mention any behavioral traits like authentication needs, rate limits, error conditions, or what 'comprehensive information' entails. 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.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and easy to parse, though it could be slightly more structured by including usage hints without sacrificing brevity.

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 complexity of retrieving provider information, the lack of annotations, and no output schema, the description is insufficient. It does not explain what 'comprehensive information' includes, potential return formats, or any operational constraints, making it incomplete for effective agent use.

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?

The input schema has 100% description coverage, clearly documenting the single parameter 'provider_name'. The description adds no additional meaning beyond the schema, such as examples or constraints, but since the schema is comprehensive, the baseline score of 3 is appropriate as it doesn't detract from understanding.

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') and resource ('comprehensive information about a Terraform provider'), making the purpose evident. However, it does not explicitly differentiate from sibling tools like 'get_terraform_resource_info' or 'list_terraform_providers', which reduces the score from a 5.

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?

No guidance is provided on when to use this tool versus alternatives such as 'list_terraform_providers' or 'get_terraform_resource_info'. The description lacks context about use cases, prerequisites, or exclusions, leaving the agent without direction on tool selection.

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'

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