Skip to main content
Glama
AgentWong

IAC Memory MCP Server

by AgentWong

add_terraform_provider

Add Terraform providers to a memory store with version and documentation details for Infrastructure-as-Code management.

Instructions

Add a new Terraform provider to the memory store with version and documentation information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesProvider name
versionYesProvider version
source_urlYesSource repository URL
doc_urlYesDocumentation URL

Implementation Reference

  • MCP tool handler that validates input arguments (name, version, source_url, doc_url), checks version format, calls the database add_terraform_provider function, and returns success/error TextContent.
    async def handle_add_terraform_provider(db: Any, arguments: Dict[str, Any], operation_id: str) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        """Handle add_terraform_provider tool."""
        # Validate required arguments
        required_args = ["name", "version", "source_url", "doc_url"]
        missing_args = [arg for arg in required_args if arg not in arguments]
        if missing_args:
            error_msg = f"Missing required arguments for add_terraform_provider: {', '.join(missing_args)}"
            logger.error(error_msg, extra={"operation_id": operation_id})
            return [types.TextContent(type="text", text=error_msg)]
    
        # Validate version format (x.y.z)
        version_pattern = re.compile(r'^\d+\.\d+\.\d+$')
        if not version_pattern.match(arguments["version"]):
            error_msg = "Invalid version format. Version must be in x.y.z format (e.g. 1.0.0)"
            logger.error(error_msg, extra={"operation_id": operation_id})
            return [types.TextContent(
                type="text",
                text=error_msg
            )]
    
        try:
            # Add provider
            logger.info(
                "Adding Terraform provider",
                extra={
                    "provider_name": arguments["name"],
                    "version": arguments["version"],
                    "operation_id": operation_id,
                },
            )
    
            provider_id = add_terraform_provider(
                db,
                arguments["name"],
                arguments["version"],
                arguments["source_url"],
                arguments["doc_url"],
            )
    
            return [types.TextContent(
                type="text",
                text=f"Added provider {arguments['name']} with ID: {provider_id}"
            )]
    
        except Exception as e:
            error_msg = f"Failed to add provider: {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 and validation rules for the add_terraform_provider tool.
    "add_terraform_provider": {
        "type": "object",
        "description": "Add a new Terraform provider to the memory store with version and documentation information",
        "required": ["name", "version", "source_url", "doc_url"],
        "properties": {
            "name": {"type": "string", "description": "Provider name"},
            "version": {"type": "string", "description": "Provider version"},
            "source_url": {"type": "string", "description": "Source repository URL"},
            "doc_url": {"type": "string", "description": "Documentation URL"},
        },
    },
  • Tool handler registration dictionary mapping the tool name 'add_terraform_provider' to its handler function.
    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,
    }
  • Core database helper function that performs the SQL INSERT into terraform_providers table and returns the new provider ID.
    def add_terraform_provider(
        db: DatabaseManager,
        name: str,
        version: str,
        source_url: str,
        doc_url: str,
    ) -> str:
        """Add a new Terraform provider with proper error handling."""
        logger.info(
            "Adding Terraform provider",
            extra={"provider_name": name, "version": version, "source_url": source_url},
        )
    
        try:
            with db.get_connection() as conn:
                conn.execute("BEGIN IMMEDIATE")
                try:
                    cursor = conn.execute(
                        """INSERT INTO terraform_providers 
                        (name, version, source_url, doc_url, updated_at)
                        VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP)""",
                        (name, version, source_url, doc_url),
                    )
    
                    conn.commit()
                    provider_id = str(cursor.lastrowid)
    
                    logger.info(
                        f"Successfully added provider {name}",
                        extra={"provider_id": provider_id, "provider_name": name},
                    )
                    return provider_id
                except Exception:
                    conn.rollback()
                    raise
        except sqlite3.Error as e:
            error_msg = f"Failed to add Terraform provider: {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 full burden but offers minimal behavioral insight. It implies a write operation ('Add') but doesn't disclose critical traits like whether this is idempotent, what happens on duplicate entries, authentication requirements, or error handling. The mention of 'memory store' hints at ephemeral storage but lacks details on persistence or scope.

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 earns its place by specifying the action, resource, destination, and key information included, making it easy to parse quickly.

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 no annotations and no output schema, the description is incomplete for a tool that performs a write operation. It lacks details on return values, error conditions, side effects, and how it interacts with sibling tools (e.g., updates or retrievals). The mention of 'memory store' provides some context but is insufficient for full understanding.

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 fully documents all 4 parameters (name, version, source_url, doc_url). The description adds no additional parameter semantics beyond restating the schema's description, meeting the baseline of 3 for high schema coverage without extra 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 ('Add'), resource ('Terraform provider'), and destination ('to the memory store') with specific details about what information is included ('with version and documentation information'). It distinguishes from sibling tools like 'add_terraform_resource' by focusing on providers rather than resources, though it doesn't explicitly contrast with them.

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 like 'update_provider_version' or 'get_terraform_provider_info'. The description mentions adding 'to the memory store' but doesn't clarify prerequisites, such as whether the provider must already exist elsewhere or if this creates a new entry from scratch.

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