Skip to main content
Glama

list_provider_resources

Retrieve all resources linked to a Terraform provider, with optional regex filtering for specific resource types. Enhances IaC management via the IaC Memory MCP Server.

Instructions

List all resources associated with a specific Terraform provider

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filter_criteriaNoOptional filtering criteria
provider_nameYesName of the Terraform provider

Implementation Reference

  • The main handler function that executes the list_provider_resources tool logic. It fetches resources for a given provider from the database, applies optional filters, formats the output as text, and handles errors.
    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 structure and validation for the list_provider_resources tool, including required provider_name and optional filter_criteria.
    "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", } }, }, }, },
  • Mapping dictionary that registers the list_provider_resources tool name to its handler function, used in the MCP tool dispatching logic.
    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, }

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