Skip to main content
Glama
AgentWong

IAC Memory MCP Server

by AgentWong

list_provider_resources

Retrieve all Terraform provider resources with optional filtering by type pattern to manage infrastructure-as-code configurations.

Instructions

List all resources associated with a specific Terraform provider

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
provider_nameYesName of the Terraform provider
filter_criteriaNoOptional filtering criteria

Implementation Reference

  • The main execution handler for the 'list_provider_resources' tool. It retrieves resources from the database for a given provider, applies optional regex filtering on resource types, formats them into a readable list, and returns as TextContent.
    async def handle_list_provider_resources(
        db: Any, arguments: Dict[str, Any], operation_id: str
    ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        """Handle list_provider_resources tool."""
        try:
            logger.info(
                "Listing provider resources",
                extra={
                    "provider_name": arguments["provider_name"],
                    "operation_id": operation_id,
                },
            )
    
            # Get resources
            resources = get_provider_resources(db, arguments["provider_name"])
    
            # Apply any filters
            filter_criteria = arguments.get("filter_criteria", {})
            if filter_criteria:
                if "type_pattern" in filter_criteria:
                    pattern = re.compile(filter_criteria["type_pattern"])
                    resources = [r for r in resources if pattern.match(r["resource_type"])]
    
            # Format output
            if not resources:
                return [types.TextContent(
                    type="text",
                    text=f"No resources found for provider {arguments['provider_name']}"
                )]
    
            output = [f"Resources for provider {arguments['provider_name']}:"]
            for r in resources:
                output.append(
                    f"\n- {r['name']} ({r['resource_type']})"
                    f"\n  Version: {r['version']}"
                    f"\n  Documentation: {r['doc_url']}"
                )
    
            return [types.TextContent(
                type="text",
                text="\n".join(output)
            )]
    
        except Exception as e:
            error_msg = f"Failed to list provider resources: {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 'list_provider_resources' tool, including required 'provider_name' and optional 'filter_criteria' with 'type_pattern'.
    "list_provider_resources": {
        "type": "object",
        "description": "List all resources associated with a specific Terraform provider",
        "required": ["provider_name"],
        "properties": {
            "provider_name": {
                "type": "string",
                "description": "Name of the Terraform provider",
            },
            "filter_criteria": {
                "type": "object",
                "description": "Optional filtering criteria",
                "properties": {
                    "type_pattern": {
                        "type": "string",
                        "description": "Regex pattern to filter resource types",
                    }
                },
            },
        },
  • Dictionary mapping tool names to their handler functions, registering 'list_provider_resources' to 'handle_list_provider_resources' for use in the MCP server.
    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 it's a list operation, implying it's read-only, but doesn't cover critical aspects like pagination, rate limits, authentication requirements, error handling, or what 'all resources' entails (e.g., if it includes deprecated ones). This is a significant gap 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's appropriately sized and front-loaded, making it easy for an agent 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 no annotations, no output schema, and a read operation with potential complexity (filtering, large result sets), the description is incomplete. It lacks details on behavioral traits (e.g., pagination), return format, or error cases, which are essential for an agent to use this tool effectively in a Terraform context.

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%, so the schema already documents both parameters ('provider_name' and 'filter_criteria'). The description adds no additional meaning beyond what's in the schema, such as examples of provider names or how filtering works. 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 action ('List all resources') and the target ('associated with a specific Terraform provider'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_terraform_providers' or 'get_terraform_resource_info', 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 'list_terraform_providers' (which lists providers) or 'get_terraform_resource_info' (which might get details on a specific resource), 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