Skip to main content
Glama
AgentWong
by AgentWong

add_terraform_provider

Store Terraform provider details including version, source repository, and documentation in persistent memory for version tracking and relationship mapping.

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: validates input arguments (name, version, source_url, doc_url), calls the database helper function, logs operations, and returns TextContent with success message containing provider ID or error.
    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)]
  • Tool handler registration dictionary mapping 'add_terraform_provider' to its async 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,
    }
  • JSON schema defining required inputs (name, version, source_url, doc_url) and properties for the 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"},
        },
    },
  • Core database helper: inserts new provider record into 'terraform_providers' table using transaction, returns generated 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 the full burden of behavioral disclosure. It states this is an 'Add' operation (implying creation/mutation) but doesn't describe what happens on success/failure, whether duplicates are allowed, if the memory store is persistent, or any side effects. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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 element ('Add a new Terraform provider', 'to the memory store', 'with version and documentation information') serves a clear purpose, making it appropriately sized and well-structured.

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?

For a 4-parameter mutation tool with no annotations and no output schema, the description is minimally adequate. It covers the basic purpose but lacks behavioral details (e.g., what 'memory store' means, success criteria, error handling) and doesn't explain return values. Given the complexity and missing structured data, it should provide more context to be truly complete.

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 description mentions 'version and documentation information' which aligns with the 'version', 'source_url', and 'doc_url' parameters, but doesn't add meaning beyond what the schema already provides. With 100% schema description coverage, the baseline is 3, and the description doesn't significantly enhance parameter understanding beyond the schema's clear documentation.

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 a new Terraform provider') and the target ('to the memory store'), specifying the resource type (Terraform provider) and what information is included (version and documentation). It distinguishes from siblings like 'add_terraform_resource' by focusing on providers rather than resources, but doesn't explicitly contrast with 'create_entity' which might be a more generic alternative.

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. It doesn't mention when to choose 'add_terraform_provider' over 'create_entity' (which appears to be a generic creation tool) or 'update_provider_version', nor does it specify prerequisites or exclusions for usage.

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