Skip to main content
Glama
wesbos

Currency Converter MCP

by wesbos

get_currencies

Retrieve a list of available currencies for conversion using real-time exchange rate data from the Frankfurter API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that fetches the list of available currencies from the Frankfurter API endpoint and returns the data as a JSON string in a ToolResponse format, or an error message if the fetch fails.
    export async function getCurrencies(
    	_input: GetCurrenciesInput,
    ): Promise<ToolResponse> {
    	try {
    		const url = `${FRANKFURTER_API_BASE}/currencies`;
    		const response = await fetch(url);
    
    		if (!response.ok) {
    			return {
    				content: [
    					{
    						type: "text",
    						text: `Error: Unable to fetch currencies. Status: ${response.status}`,
    					},
    				],
    			};
    		}
    
    		const data = (await response.json()) as CurrenciesResponse;
    
    		return {
    			content: [
    				{
    					type: "text",
    					text: JSON.stringify(data),
    				},
    			],
    		};
    	} catch (error) {
    		return {
    			content: [
    				{
    					type: "text",
    					text: `Error: Failed to fetch currencies - ${error instanceof Error ? error.message : "Unknown error"}`,
    				},
    			],
    		};
    	}
    }
  • The schema definition (empty object indicating no input parameters) and TypeScript types for input (empty record) and output (CurrenciesResponse).
    export const getCurrenciesSchema = {};
    
    export type GetCurrenciesInput = Record<string, never>;
    
    export type GetCurrenciesOutput = CurrenciesResponse;
  • src/index.ts:33-35 (registration)
    The registration of the "get_currencies" tool on the MCP server, providing the schema and handler function.
    this.server.tool("get_currencies", getCurrenciesSchema, async (input) =>
      getCurrencies(input),
    );

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

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/wesbos/currency-conversion-mcp'

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