List supported currencies
list_currenciesGet a complete list of supported currency codes, including over 170 fiat currencies and major cryptocurrencies, from the UniRate API.
Instructions
Return the list of currency codes supported by the UniRate API (170+ fiat plus major crypto).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:168-179 (handler)The async handler function that executes the 'list_currencies' tool logic. It calls client.getSupportedCurrencies() and returns a formatted string with the count and list of currency codes.
async () => { try { const currencies = await client.getSupportedCurrencies(); return ok( `${currencies.length} currencies supported: ${currencies.join(", ")}`, { count: currencies.length, currencies }, ); } catch (err) { return fail(err); } }, ); - src/index.ts:161-166 (schema)The input schema for 'list_currencies'. No input parameters are required (empty inputSchema object). Includes title, description, and annotations.
{ title: "List supported currencies", description: "Return the list of currency codes supported by the UniRate API (170+ fiat plus major crypto).", inputSchema: {}, annotations: { readOnlyHint: true, openWorldHint: true }, - src/index.ts:159-179 (registration)The tool registration via server.registerTool('list_currencies', ...) which registers the tool name, schema, and handler on the MCP server.
server.registerTool( "list_currencies", { title: "List supported currencies", description: "Return the list of currency codes supported by the UniRate API (170+ fiat plus major crypto).", inputSchema: {}, annotations: { readOnlyHint: true, openWorldHint: true }, }, async () => { try { const currencies = await client.getSupportedCurrencies(); return ok( `${currencies.length} currencies supported: ${currencies.join(", ")}`, { count: currencies.length, currencies }, ); } catch (err) { return fail(err); } }, ); - src/client.ts:182-185 (helper)The client method getSupportedCurrencies() that performs the actual API call to /api/currencies to retrieve the list of supported currency codes.
async getSupportedCurrencies(): Promise<string[]> { const data = await this.request<{ currencies: string[] }>("/api/currencies", {}); return data.currencies; }