Skip to main content
Glama
nexusforge-tools

NexusForge EU Finance

Official

get_euro_exchange

Read-onlyIdempotent

Retrieve EUR exchange rates from ECB for 33 currencies, including USD, GBP, JPY. Supports latest or historical rates (from 1999-01-04) in JSON format with caching for efficient data access.

Instructions

Fetches EUR exchange rates against other currencies from the ECB via Frankfurter API. Returns a JSON object with: base ("EUR"), date (YYYY-MM-DD of the rate), rates (object mapping 3-letter currency codes to numeric values representing how many units of that currency equal 1 EUR), source, and retrieved_at as ISO 8601. Latest rates are cached 1 hour; historical rates are cached permanently. USAGE: Supports 33 currencies including USD, GBP, JPY, CHF, CNY, SEK, PLN, and others. Omit date for the latest available rates. Provide date in YYYY-MM-DD format for historical rates (available from 1999-01-04). These are ECB reference rates published at ~16:00 CET — not real-time mid-market rates; expect small spreads vs live quotes. Requests for weekends or ECB holidays return the previous business day's rates. Returns an error for dates before 1999-01-04 or future dates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
currenciesNoList of 3-letter currency codes (e.g. ["USD", "GBP", "JPY"]). Omit for all available currencies.
dateNoHistorical date in YYYY-MM-DD format. Omit for latest rates.

Implementation Reference

  • The tool handler function that executes the exchange rate lookup: builds a cache key, checks cache, fetches from Frankfurter API (ECB data), formats result with source attribution, and caches before returning.
      async ({ currencies, date }) => {
        return withMcpMiddleware({ serverName: SERVER_NAME, toolName: 'get_euro_exchange' }, async () => {
          const params = { currencies, date };
          const cacheKey = `get_euro_exchange:${hashParams(params as Record<string, unknown>)}`;
          const cached = await cacheGet<ExchangeRateResult>(cacheKey);
          if (cached) {
            return { content: [{ type: 'text' as const, text: JSON.stringify(cached, null, 2) }] };
          }
    
          const endpoint = date ? `${FRANKFURTER_BASE}/${date}` : `${FRANKFURTER_BASE}/latest`;
          const searchParams = new URLSearchParams({ base: 'EUR' });
          if (currencies?.length) {
            searchParams.set('to', currencies.join(','));
          }
    
          const res = await fetch(`${endpoint}?${searchParams}`, {
            signal: AbortSignal.timeout(10_000),
          });
    
          if (!res.ok) {
            if (res.status === 404) {
              return makeMcpError(
                `No exchange rate data found for date ${date ?? 'latest'}`,
                'SOURCE_UNAVAILABLE',
              );
            }
            return makeMcpError(
              `Frankfurter API returned ${res.status}`,
              'SOURCE_UNAVAILABLE',
            );
          }
    
          const json = (await res.json()) as { amount: number; base: string; date: string; rates: Record<string, number> };
    
          const result: ExchangeRateResult = {
            base: json.base,
            date: json.date,
            rates: json.rates,
            source: 'European Central Bank via Frankfurter.app',
            retrieved_at: new Date().toISOString(),
          };
    
          await cacheSet(cacheKey, result, CACHE_TTL);
          return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }] };
        });
      },
    );
  • Input schema using Zod: optional 'currencies' array of 3-letter codes (uppercased) and optional 'date' string matching YYYY-MM-DD format.
    {
      currencies: z
        .array(z.string().length(3).toUpperCase())
        .optional()
        .describe('List of 3-letter currency codes (e.g. ["USD", "GBP", "JPY"]). Omit for all available currencies.'),
      date: z
        .string()
        .regex(/^\d{4}-\d{2}-\d{2}$/)
        .optional()
        .describe('Historical date in YYYY-MM-DD format. Omit for latest rates.'),
    },
  • Registration function that registers the 'get_euro_exchange' tool on an McpServer instance with schema, read-only annotations, and handler.
    export function registerEuroExchangeTool(server: McpServer): void {
      server.tool(
        'get_euro_exchange',
        'Fetches EUR exchange rates against other currencies from the ECB via Frankfurter API. Returns a JSON object with: `base` ("EUR"), `date` (YYYY-MM-DD of the rate), `rates` (object mapping 3-letter currency codes to numeric values representing how many units of that currency equal 1 EUR), `source`, and `retrieved_at` as ISO 8601. Latest rates are cached 1 hour; historical rates are cached permanently. USAGE: Supports 33 currencies including USD, GBP, JPY, CHF, CNY, SEK, PLN, and others. Omit `date` for the latest available rates. Provide `date` in YYYY-MM-DD format for historical rates (available from 1999-01-04). These are ECB reference rates published at ~16:00 CET — not real-time mid-market rates; expect small spreads vs live quotes. Requests for weekends or ECB holidays return the previous business day\'s rates. Returns an error for dates before 1999-01-04 or future dates.',
        {
          currencies: z
            .array(z.string().length(3).toUpperCase())
            .optional()
            .describe('List of 3-letter currency codes (e.g. ["USD", "GBP", "JPY"]). Omit for all available currencies.'),
          date: z
            .string()
            .regex(/^\d{4}-\d{2}-\d{2}$/)
            .optional()
            .describe('Historical date in YYYY-MM-DD format. Omit for latest rates.'),
        },
        READ_ONLY_PUBLIC_API,
        async ({ currencies, date }) => {
          return withMcpMiddleware({ serverName: SERVER_NAME, toolName: 'get_euro_exchange' }, async () => {
            const params = { currencies, date };
            const cacheKey = `get_euro_exchange:${hashParams(params as Record<string, unknown>)}`;
            const cached = await cacheGet<ExchangeRateResult>(cacheKey);
            if (cached) {
              return { content: [{ type: 'text' as const, text: JSON.stringify(cached, null, 2) }] };
            }
    
            const endpoint = date ? `${FRANKFURTER_BASE}/${date}` : `${FRANKFURTER_BASE}/latest`;
            const searchParams = new URLSearchParams({ base: 'EUR' });
            if (currencies?.length) {
              searchParams.set('to', currencies.join(','));
            }
    
            const res = await fetch(`${endpoint}?${searchParams}`, {
              signal: AbortSignal.timeout(10_000),
            });
    
            if (!res.ok) {
              if (res.status === 404) {
                return makeMcpError(
                  `No exchange rate data found for date ${date ?? 'latest'}`,
                  'SOURCE_UNAVAILABLE',
                );
              }
              return makeMcpError(
                `Frankfurter API returned ${res.status}`,
                'SOURCE_UNAVAILABLE',
              );
            }
    
            const json = (await res.json()) as { amount: number; base: string; date: string; rates: Record<string, number> };
    
            const result: ExchangeRateResult = {
              base: json.base,
              date: json.date,
              rates: json.rates,
              source: 'European Central Bank via Frankfurter.app',
              retrieved_at: new Date().toISOString(),
            };
    
            await cacheSet(cacheKey, result, CACHE_TTL);
            return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }] };
          });
        },
      );
    }
  • Type interface defining the structure of the tool's return value: base currency, date, rates map, source info, and retrieval timestamp.
    interface ExchangeRateResult {
      base: string;
      date: string;
      rates: Record<string, number>;
      source: string;
      retrieved_at: string;
    }
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds significant behavioral context beyond annotations: caching delays (1 hour for latest, permanent for historical), non-real-time nature (published ~16:00 CET), weekend/holiday fallback, and date range constraints. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured: starts with purpose, then output format, caching, usage, limitations. Informative but slightly verbose; could be tightened without losing substance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description fully explains the return JSON structure, parameters, caching, and edge cases. Complete for a tool with 2 optional parameters.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and description adds meaning: explains 'currencies' is a list of 3-letter codes (omit for all) and 'date' format/range, plus behavior when omitted. Adds value beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it fetches EUR exchange rates from the ECB via Frankfurter API, specifying the source and output structure. It distinguishes itself from sibling tools by focusing on exchange rates, but does not explicitly differentiate from 'get_ecb_rates' which might overlap.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear usage guidance: omit 'date' for latest rates, provide YYYY-MM-DD for historical, lists supported currencies, and explains caching behavior. However, it lacks explicit when-not-to-use guidance or alternatives among siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/nexusforge-tools/mcp-eu-finance'

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