Skip to main content
Glama
fetcher.ts1.48 kB
/** get all icon repo names */ export async function getIconRepoNames<T>(): Promise<T | null> { try { const res = await fetch(`https://api.iconify.design/collections`, { method: "GET", }); if (!res.ok) { throw new Error(`HTTP error! status: ${res.status}`); } return (await res.json()) as T; } catch (error) { console.error("Error making request:", error); return null; } } /** get icon collection by prefix And desc (LIKE AS ant-design) */ export async function searchIconsByPrefixAndDesc<T>( prefix: string, desc: string ): Promise<T | null> { try { const res = await fetch( `https://api.iconify.design/search?query=${desc}&prefix=${prefix}`, { method: "GET", } ); if (!res.ok) { throw new Error(`HTTP error! status: ${res.status}`); } return (await res.json()) as T; } catch (error) { console.error("Error making request:", error); return null; } } /** get icon by prefix and svg name */ export async function getIconByPrefixAndName<T>( prefix: string, svgName: string ): Promise<T | null> { try { const res = await fetch( `https://api.iconify.design/${prefix}/${svgName}.svg`, { method: "GET", } ); if (!res.ok) { throw new Error(`HTTP error! status: ${res.status}`); } return (await res.text()) as T; } catch (error) { console.error("Error making request:", error); return null; } }

Implementation Reference

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/Leee62/pickapicon-mcp'

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