list_icon_providers_tool
Discover available icon providers and their categories. Get an overview of the icon catalog structure with provider details and category counts.
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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function for list_icon_providers_tool, registered via @mcp.tool decorator. It uses the fetcher's get_icon_providers() method to retrieve and return information about all available icon providers and their categories.
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)The tool is registered with FastMCP via the @mcp.tool() decorator inside register_fetch_icons_tool(), which is called from server.py line 73.
@mcp.tool( annotations={ "title": "List Available Icon Providers", "readOnlyHint": True, "description": "Lists all available icon providers and categories from the icon catalog", } ) - The IlographContentFetcher.get_icon_providers() helper method that fetches and parses the icon catalog, organizing icons by provider with category counts and total counts.
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 - The tool annotations define the schema/metadata for list_icon_providers_tool, including title, readOnlyHint, and description.
annotations={ "title": "List Available Icon Providers", "readOnlyHint": True, "description": "Lists all available icon providers and categories from the icon catalog", } ) 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" )