Skip to main content
Glama
AgentWong
by AgentWong

list_provider_resources

Retrieve Terraform provider resources with optional filtering by type pattern to manage infrastructure components.

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 handler function that implements the tool logic: retrieves provider resources from the database, applies optional regex filtering on resource types, formats a text list of resources with names, types, versions, and documentation URLs, or returns an error message.
    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)]
  • Input schema validation for the tool, requiring 'provider_name' and optionally 'filter_criteria' with 'type_pattern' for regex filtering.
    "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",
                    }
                },
            },
        },
    },
  • Registers the 'list_provider_resources' tool handler within the terraform_tool_handlers dictionary used for tool dispatching.
    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,
    }
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 'List all resources' but does not describe key behaviors such as pagination, rate limits, authentication requirements, or what 'all resources' entails (e.g., if it includes deprecated ones). This leaves significant gaps for a tool with potential complexity.

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 and earns its place by clearly conveying the core functionality, making it highly concise and well-structured.

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 and no output schema, the description is incomplete for a tool that lists resources. It lacks details on behavioral traits (e.g., pagination, error handling), output format, or usage context, which are critical for an agent to invoke it correctly in a Terraform management environment.

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 clear descriptions for both parameters (provider_name and filter_criteria with type_pattern). The description does not add any additional meaning beyond what the schema provides, such as examples or usage context for the filter_criteria, so it meets the baseline score.

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'), providing a specific verb+resource combination. However, it does not explicitly differentiate from sibling tools like 'list_terraform_providers' or 'get_terraform_resource_info', which reduces it from 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 does not mention sibling tools like 'list_terraform_providers' for listing providers instead of resources, or 'get_terraform_resource_info' for detailed info 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-project'

If you have feedback or need assistance with the MCP directory API, please join our Discord server