Skip to main content
Glama
AgentWong

IAC Memory MCP Server

by AgentWong

get_resource_version_compatibility

Check Terraform resource compatibility across provider versions to ensure infrastructure code works with target versions.

Instructions

Check resource compatibility across provider versions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
provider_nameYesName of the Terraform provider
resource_nameYesName of the resource to check
versionYesTarget provider version to check compatibility against

Implementation Reference

  • Defines the JSON schema for the tool's input parameters and description.
    "get_resource_version_compatibility": {
        "type": "object",
        "description": "Check resource compatibility across provider versions",
        "required": ["provider_name", "resource_name", "version"],
        "properties": {
            "provider_name": {
                "type": "string",
                "description": "Name of the Terraform provider",
            },
            "resource_name": {
                "type": "string",
                "description": "Name of the resource to check",
            },
            "version": {
                "type": "string",
                "description": "Target provider version to check compatibility against",
            },
        },
    },
  • Implements the core logic for checking Terraform resource compatibility between provider versions by querying database for schemas and comparing required fields and property types.
    def check_resource_version_compatibility(
        db: DatabaseManager, provider_name: str, resource_name: str, version: str
    ) -> Dict:
        """Check resource compatibility across provider versions.
    
        Args:
            db: Database manager instance
            provider_name: Name of the provider
            resource_name: Name of the resource
            version: Target provider version to check against
    
        Returns:
            Dictionary containing compatibility status and potential issues
        """
        logger.info(
            "Checking resource version compatibility",
            extra={
                "provider": provider_name,
                "resource": resource_name,
                "target_version": version,
                "operation": "check_resource_version_compatibility",
            },
        )
    
        try:
            with db.get_connection() as conn:
                # Get resource info for current version
                current = conn.execute(
                    """
                    SELECT r.*, p.version as provider_version
                    FROM terraform_resources r
                    JOIN terraform_providers p ON r.provider_id = p.id
                    WHERE p.name = ? AND r.name = ?
                    ORDER BY p.created_at DESC
                    LIMIT 1
                    """,
                    (provider_name, resource_name),
                ).fetchone()
    
                if not current:
                    raise ValueError(
                        f"Resource {resource_name} not found for provider {provider_name}"
                    )
    
                # Get resource info for target version
                target = conn.execute(
                    """
                    SELECT r.*, p.version as provider_version
                    FROM terraform_resources r
                    JOIN terraform_providers p ON r.provider_id = p.id
                    WHERE p.name = ? AND r.name = ? AND p.version = ?
                    """,
                    (provider_name, resource_name, version),
                ).fetchone()
    
                if not target:
                    return {
                        "is_compatible": False,
                        "current_version": current["provider_version"],
                        "target_version": version,
                        "issues": [
                            f"Resource {resource_name} not found in provider version {version}"
                        ],
                    }
    
                # Compare schemas to determine compatibility
                import json
    
                current_schema = json.loads(current["schema"])
                target_schema = json.loads(target["schema"])
    
                issues = []
    
                # Check for removed required fields
                current_required = set(current_schema.get("required", []))
                target_required = set(target_schema.get("required", []))
                removed_required = current_required - target_required
                if removed_required:
                    issues.append(
                        f"Required fields removed in target version: {', '.join(removed_required)}"
                    )
    
                # Check for changed field types
                current_props = current_schema.get("properties", {})
                target_props = target_schema.get("properties", {})
    
                for field, props in current_props.items():
                    if field in target_props:
                        if props.get("type") != target_props[field].get("type"):
                            issues.append(
                                f"Field type changed for '{field}': "
                                f"{props.get('type')} -> {target_props[field].get('type')}"
                            )
    
                return {
                    "is_compatible": len(issues) == 0,
                    "current_version": current["provider_version"],
                    "target_version": version,
                    "issues": issues if issues else ["No compatibility issues found"],
                }
    
        except sqlite3.Error as e:
            error_msg = f"Failed to check resource compatibility: {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 action ('Check') but does not describe what the check entails (e.g., returns compatibility status, errors, or details), whether it's read-only or has side effects, or any constraints like rate limits. This is a significant gap for a tool with no annotation coverage, making it unclear how the tool behaves beyond its basic purpose.

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 directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy to parse quickly. Every part of the sentence earns its place by conveying essential information.

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 checking compatibility and the lack of annotations and output schema, the description is incomplete. It does not explain what the tool returns (e.g., compatibility status, details, or errors) or any behavioral aspects like error handling. For a tool with no structured output and no annotations, more context is needed to guide effective 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 schema description coverage is 100%, with all parameters well-documented in the input schema (provider_name, resource_name, version). The description does not add any additional meaning or context beyond what the schema provides, such as explaining the format of version strings or examples. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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 ('Check') and the target ('resource compatibility across provider versions'), which is specific and actionable. It distinguishes itself from siblings like 'get_module_version_compatibility' by focusing on resources rather than modules, but could be more explicit about this distinction. The purpose is not vague or tautological, though it lacks some nuance about what 'compatibility' entails.

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 does not mention prerequisites, context, or exclusions, such as when to use 'get_module_version_compatibility' instead for modules. There is no explicit or implied usage advice, leaving the agent to infer based on tool names alone.

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