Skip to main content
Glama
AgentWong

IAC Memory MCP Server

by AgentWong

get_terraform_resource_info

Retrieve Terraform resource schema and documentation to understand configuration options and usage details for infrastructure-as-code development.

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 executes the core logic of the get_terraform_resource_info tool. It retrieves resource information from the database using get_resource_info, formats the output including schema and documentation, and handles errors.
    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 for the get_terraform_resource_info tool, including required fields provider_name and resource_name.
    "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"},
        },
    },
  • Dictionary mapping tool names to their handler functions, registering get_terraform_resource_info to handle_get_terraform_resource_info.
    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,
    }
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 aspects like authentication requirements, rate limits, error handling, or the format of the returned information. This leaves significant gaps for a tool with no annotation coverage.

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 with the core action and resource, 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 the complexity of retrieving Terraform resource information, the lack of annotations, and no output schema, the description is insufficient. It doesn't explain what 'comprehensive information' includes, how the data is structured, or any behavioral traits like permissions or limitations, making it incomplete for 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 both parameters ('provider_name' and 'resource_name') clearly documented in the input schema. The description adds no additional parameter details beyond what the schema provides, so it meets the baseline score of 3 for high schema coverage without adding 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 verb 'Retrieve' and the resource 'comprehensive information about a Terraform resource including schema and documentation', making the purpose specific and understandable. However, it doesn't explicitly distinguish this tool from sibling tools like 'get_terraform_provider_info' or 'list_provider_resources', which prevents a perfect score.

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 sibling tools like 'get_terraform_provider_info' for provider-level info or 'list_provider_resources' for listing resources, leaving the agent without context for tool selection.

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