Skip to main content
Glama
AgentWong
by AgentWong

get_terraform_resource_info

Retrieve Terraform resource schema and documentation to understand configuration options and usage requirements for infrastructure components.

Instructions

Retrieve comprehensive information about a Terraform resource including schema and documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
provider_nameYesName of the Terraform provider
resource_nameYesName of the resource

Implementation Reference

  • The handler function that implements the core logic of the 'get_terraform_resource_info' tool. It retrieves resource information from the database and formats it for output.
    async def handle_get_terraform_resource_info(
        db: Any, arguments: Dict[str, Any], operation_id: str
    ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        """Handle get_terraform_resource_info tool."""
        try:
            logger.info(
                "Getting resource info",
                extra={
                    "provider_name": arguments["provider_name"],
                    "resource_name": arguments["resource_name"],
                    "operation_id": operation_id,
                },
            )
    
            # Get resource info
            resource = get_resource_info(
                db,
                arguments["resource_name"],
                provider_name=arguments["provider_name"]
            )
            if not resource:
                error_msg = f"Resource '{arguments['resource_name']}' not found for provider '{arguments['provider_name']}'"
                logger.error(error_msg, extra={"operation_id": operation_id})
                return [types.TextContent(
                    type="text",
                    text=error_msg
                )]
    
            # Format output
            output = [
                f"Resource: {resource['name']}",
                f"Provider: {resource['provider_name']}",
                f"Type: {resource['resource_type']}",
                f"Version: {resource['version']}",
                f"Documentation: {resource['doc_url']}",
                "\nSchema:",
                resource["schema"],
            ]
    
            return [types.TextContent(
                type="text",
                text="\n".join(output)
            )]
    
        except Exception as e:
            error_msg = f"Failed to get resource 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 and validation rules for the tool.
    "get_terraform_resource_info": {
        "type": "object",
        "description": "Retrieve comprehensive information about a Terraform resource including schema and documentation",
        "required": ["provider_name", "resource_name"],
        "properties": {
            "provider_name": {
                "type": "string",
                "description": "Name of the Terraform provider",
            },
            "resource_name": {"type": "string", "description": "Name of the resource"},
        },
    },
  • Registration of the handler function 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,
    }
  • Global registration where terraform_tool_handlers (including get_terraform_resource_info) is imported and merged into the combined tool_handlers dictionary used by the MCP server.
    from .ansible import ansible_tool_handlers
    from .base import base_call_tool, base_list_tools
    from .entity import entity_tool_handlers
    from .terraform import terraform_tool_handlers
    
    # Configure package logger
    logger = logging.getLogger("iac_memory.tools")
    
    # Combine all tool handlers
    tool_handlers = {
        **terraform_tool_handlers,
        **ansible_tool_handlers,
        **entity_tool_handlers,
    }
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 doesn't specify whether it requires authentication, has rate limits, returns paginated results, or details the output format. For a 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.

Conciseness4/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. It avoids redundancy and wastes no words, though it could be slightly more structured by separating purpose from scope details.

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?

Given 2 parameters with full schema coverage but no annotations and no output schema, the description is minimally adequate. It covers the 'what' but lacks behavioral context like authentication needs or return format. For a read tool with simple inputs, it meets basic needs but leaves room for improvement in completeness.

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 both parameters ('provider_name' and 'resource_name') well-documented in the schema. The description adds no additional parameter semantics beyond what's in the schema, such as format examples or constraints. Baseline 3 is appropriate when the schema does the heavy lifting.

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 verb 'retrieve' and the resource 'Terraform resource information', specifying it includes 'schema and documentation'. It distinguishes from sibling tools like 'get_erraform_provider_info' by focusing on resources rather than providers, though it doesn't explicitly contrast with other resource-related tools like 'list_provider_resources'.

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 this over sibling tools like 'get_resource_version_compatibility' or 'list_provider_resources', nor does it specify prerequisites or exclusions. Usage is implied but not explicitly defined.

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