list_icon_providers_tool
Discover all available icon providers and their categories. This tool organizes the icon catalog structure, displaying providers, service categories, and icon counts for efficient selection.
Instructions
Lists all available icon providers and their categories.
This tool provides an overview of the icon catalog structure,
showing available providers and their service categories.
Returns:
dict: Provider information with categories and icon counts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function for list_icon_providers_tool that fetches icon provider information from the fetcher instance.async def list_icon_providers_tool(ctx: Optional[Context] = None) -> Dict[str, Any]: """ Lists all available icon providers and their categories. This tool provides an overview of the icon catalog structure, showing available providers and their service categories. Returns: dict: Provider information with categories and icon counts """ try: if ctx: await ctx.info("Fetching icon provider information") # Get fetcher instance fetcher = get_fetcher() # Get provider information provider_info = await fetcher.get_icon_providers() if provider_info is None: error_msg = "Failed to fetch icon provider information. The service may be temporarily unavailable." if ctx: await ctx.error(error_msg) return {"error": error_msg} if ctx: await ctx.info( f"Retrieved information for {len(provider_info.get('providers', {}))} icon providers" ) return provider_info except Exception as e: error_msg = f"Error fetching icon provider information: {str(e)}" if ctx: await ctx.error(error_msg) return {"error": error_msg}
- src/ilograph_mcp/tools/register_fetch_icons_tool.py:127-133 (registration)FastMCP decorator that registers the list_icon_providers_tool with metadata.@mcp.tool( annotations={ "title": "List Available Icon Providers", "readOnlyHint": True, "description": "Lists all available icon providers and categories from the icon catalog", } )
- Core implementation that fetches the icon catalog, parses it, and computes provider and category statistics.async def get_icon_providers(self) -> Optional[Dict[str, Any]]: """ Get information about all available icon providers and their categories. Returns: Dictionary with provider information or None if catalog unavailable """ try: # Fetch catalog content catalog_content = await self.fetch_icon_catalog() if catalog_content is None: return None # Parse catalog into structured data all_icons = self._parse_icon_catalog(catalog_content) # Organize by provider providers: Dict[str, Any] = {} for icon in all_icons: provider = icon["provider"] category = icon["category"] if provider not in providers: providers[provider] = {"categories": {}, "total_icons": 0} if category not in providers[provider]["categories"]: providers[provider]["categories"][category] = 0 providers[provider]["categories"][category] += 1 providers[provider]["total_icons"] += 1 return { "providers": providers, "total_providers": len(providers), "message": f"Found {len(providers)} icon providers with {len(all_icons)} total icons", } except Exception as e: logger.error(f"Error getting icon providers: {e}") return None
- Factory function providing the singleton IlographContentFetcher instance used by the tool.def get_fetcher() -> IlographContentFetcher: """Get the global fetcher instance.""" return fetcher