Skip to main content
Glama

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, }

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