Skip to main content
Glama
AgentWong
by AgentWong

get_resource_version_compatibility

Check if Terraform resources work with specific provider versions to prevent deployment issues and ensure compatibility in Infrastructure-as-Code projects.

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

  • JSON schema defining the input parameters (provider_name, resource_name, version) and description for the get_resource_version_compatibility tool.
    "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",
            },
        },
    },
  • Database helper function implementing the core compatibility check logic: queries schemas for current and target provider versions, compares required fields and property types to determine compatibility and list issues.
    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)
  • Tool registration via list_tools handler which uses TOOL_SCHEMAS (including this tool's schema) to expose available tools to MCP clients.
    async def handle_list_tools(ctx: RequestContext = None) -> list:
        """Main entry point for tool listing."""
        return await base_list_tools(TOOL_SCHEMAS, ctx)
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe how it behaves: no information on output format (e.g., compatibility matrix, boolean result), error handling (e.g., if provider/resource not found), or side effects (likely none, but not confirmed). For a tool with 3 required parameters and no output schema, this leaves the agent guessing about critical operational details.

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 with zero redundancy. It's appropriately front-loaded and wastes no words, making it easy for an agent to parse quickly. Every part of the sentence contributes essential information about the tool's function.

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 tool's complexity (3 required parameters, no output schema, no annotations), the description is insufficiently complete. It doesn't explain what 'compatibility' means in practice (e.g., backward/forward compatibility, schema changes), what the output contains, or how to interpret results. With siblings that might provide related information, the description should do more to help the agent understand when and how to use this specific tool effectively.

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 all parameters well-documented in the schema (provider_name, resource_name, version). The description adds no additional parameter semantics beyond what's in the schema - it doesn't clarify format expectations (e.g., version syntax like '1.2.3'), dependencies between parameters, or examples. Given the high schema coverage, the baseline score of 3 is appropriate, but the description doesn't enhance 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 tool's purpose: 'Check resource compatibility across provider versions' - a specific verb ('check') with clear objects ('resource compatibility', 'provider versions'). It distinguishes from most siblings (e.g., get_terraform_resource_info, get_provider_version_history) by focusing on compatibility checking rather than information retrieval or history. However, it doesn't explicitly differentiate from get_module_version_compatibility, which has a similar pattern for Ansible modules.

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 prerequisites (e.g., whether the provider/resource must exist in the system), nor does it specify use cases (e.g., planning upgrades, troubleshooting). With siblings like get_terraform_resource_info and get_provider_version_history that might overlap in context, the lack of explicit differentiation is a significant gap.

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