Skip to main content
Glama
nexusforge-tools

NexusForge EU Finance

Official

get_ecb_rates

Read-onlyIdempotent

Fetches the three ECB key interest rates (deposit facility, main refinancing, marginal lending) from the ECB Statistical Data Warehouse. Returns JSON with each rate's last change date and percentage value. Data cached for 1 hour.

Instructions

Fetches the three ECB key interest rates from the ECB Statistical Data Warehouse (SDMX). Returns a JSON object with rates containing three entries — deposit_facility, main_refinancing, and marginal_lending — each with date (YYYY-MM-DD of the last rate change) and value (percentage as a number). Also includes source and retrieved_at as ISO 8601. Results are cached for 1 hour. USAGE: These are ECB policy rates, not real-time market rates — they only change at Governing Council meetings (roughly every 6 weeks). The date field indicates when the current rate was set, not today's date. For currency conversion use get_euro_exchange; these rates are not applicable for forex calculations. Use get_eu_inflation alongside this tool to assess the real interest rate (nominal rate minus inflation).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the get_ecb_rates tool logic. It checks cache, fetches three ECB key interest rates (deposit facility, main refinancing, marginal lending) via fetchEcbSeries, and returns the result as JSON.
    async () => {
      return withMcpMiddleware({ serverName: SERVER_NAME, toolName: 'get_ecb_rates' }, async () => {
        const cacheKey = `get_ecb_rates:${hashParams({})}`;
        const cached = await cacheGet<EcbRatesResult>(cacheKey);
        if (cached) {
          return { content: [{ type: 'text' as const, text: JSON.stringify(cached, null, 2) }] };
        }
    
        const [deposit, main, marginal] = await Promise.all([
          fetchEcbSeries(ECB_SERIES.deposit_facility),
          fetchEcbSeries(ECB_SERIES.main_refinancing),
          fetchEcbSeries(ECB_SERIES.marginal_lending),
        ]);
    
        if (!deposit || !main || !marginal) {
          return makeMcpError(
            'Failed to fetch ECB rates from data-api.ecb.europa.eu',
            'SOURCE_UNAVAILABLE',
          );
        }
    
        const result: EcbRatesResult = {
          rates: {
            deposit_facility: deposit,
            main_refinancing: main,
            marginal_lending: marginal,
          },
          source: 'European Central Bank Statistical Data Warehouse',
          retrieved_at: new Date().toISOString(),
        };
    
        await cacheSet(cacheKey, result, CACHE_TTL);
        return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }] };
      });
    },
  • Helper function that fetches a single ECB series (SDMX-JSON) from the ECB Statistical Data Warehouse API and returns an EcbObservation with date and value.
    async function fetchEcbSeries(seriesKey: string): Promise<EcbObservation | null> {
      const url = `https://data-api.ecb.europa.eu/service/data/${seriesKey}?format=jsondata&detail=dataonly&lastNObservations=1`;
      const res = await fetch(url, {
        headers: { Accept: 'application/json' },
        signal: AbortSignal.timeout(10_000),
      });
    
      if (!res.ok) return null;
    
      // ECB returns SDMX-JSON format
      const json = (await res.json()) as {
        dataSets: Array<{
          series: Record<string, { observations: Record<string, [number | null]> }>;
        }>;
        structure: {
          dimensions: {
            observation: Array<{ values: Array<{ id: string }> }>;
          };
        };
      };
    
      const series = json.dataSets?.[0]?.series?.['0:0:0:0:0:0:0'];
      if (!series) return null;
    
      const observations = series.observations;
      const obsDimension = json.structure?.dimensions?.observation?.[0]?.values;
      if (!obsDimension) return null;
    
      // Get the last observation (we requested lastNObservations=1, so index is "0")
      const lastIdx = Object.keys(observations).sort().pop();
      if (lastIdx === undefined) return null;
    
      const value = observations[lastIdx]?.[0];
      const date = obsDimension[parseInt(lastIdx, 10)]?.id;
    
      if (value === null || value === undefined || !date) return null;
    
      return { date, value };
    }
  • TypeScript interfaces for the tool's input/output: EcbObservation (date/value), EcbRatesResult (rates with three keys, source, retrieved_at).
    interface EcbObservation {
      date: string;
      value: number;
    }
    
    interface EcbRatesResult {
      rates: {
        deposit_facility: EcbObservation;
        main_refinancing: EcbObservation;
        marginal_lending: EcbObservation;
      };
      source: string;
      retrieved_at: string;
    }
  • Registration function registerEcbRatesTool that calls server.tool('get_ecb_rates', ...) with description, empty schema, READ_ONLY_PUBLIC_API annotations, and the async handler.
    export function registerEcbRatesTool(server: McpServer): void {
      server.tool(
        'get_ecb_rates',
        'Fetches the three ECB key interest rates from the ECB Statistical Data Warehouse (SDMX). Returns a JSON object with `rates` containing three entries — `deposit_facility`, `main_refinancing`, and `marginal_lending` — each with `date` (YYYY-MM-DD of the last rate change) and `value` (percentage as a number). Also includes `source` and `retrieved_at` as ISO 8601. Results are cached for 1 hour. USAGE: These are ECB policy rates, not real-time market rates — they only change at Governing Council meetings (roughly every 6 weeks). The `date` field indicates when the current rate was set, not today\'s date. For currency conversion use get_euro_exchange; these rates are not applicable for forex calculations. Use get_eu_inflation alongside this tool to assess the real interest rate (nominal rate minus inflation).',
        {},
        READ_ONLY_PUBLIC_API,
        async () => {
          return withMcpMiddleware({ serverName: SERVER_NAME, toolName: 'get_ecb_rates' }, async () => {
            const cacheKey = `get_ecb_rates:${hashParams({})}`;
            const cached = await cacheGet<EcbRatesResult>(cacheKey);
            if (cached) {
              return { content: [{ type: 'text' as const, text: JSON.stringify(cached, null, 2) }] };
            }
    
            const [deposit, main, marginal] = await Promise.all([
              fetchEcbSeries(ECB_SERIES.deposit_facility),
              fetchEcbSeries(ECB_SERIES.main_refinancing),
              fetchEcbSeries(ECB_SERIES.marginal_lending),
            ]);
    
            if (!deposit || !main || !marginal) {
              return makeMcpError(
                'Failed to fetch ECB rates from data-api.ecb.europa.eu',
                'SOURCE_UNAVAILABLE',
              );
            }
    
            const result: EcbRatesResult = {
              rates: {
                deposit_facility: deposit,
                main_refinancing: main,
                marginal_lending: marginal,
              },
              source: 'European Central Bank Statistical Data Warehouse',
              retrieved_at: new Date().toISOString(),
            };
    
            await cacheSet(cacheKey, result, CACHE_TTL);
            return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }] };
          });
        },
      );
    }
  • Top-level registration: calls registerEcbRatesTool(server) from the main entry point to wire up the tool.
    const server = new McpServer({ name: NAME, version: VERSION });
    registerEcbRatesTool(server);
    registerEuroExchangeTool(server);
    registerEuInflationTool(server);
    registerEuGdpTool(server);
    registerEuUnemploymentTool(server);
    registerCompareEconomiesTool(server);
    return server;
  • The tool name 'get_ecb_rates' is listed in the MCP_WELL_KNOWN.tools array for protocol discovery.
    tools: [
      'get_ecb_rates',
      'get_euro_exchange',
      'get_eu_inflation',
      'get_eu_gdp',
      'get_eu_unemployment',
      'compare_eu_economies'
    ]
  • The READ_ONLY_PUBLIC_API annotation constant used in the tool registration to mark the tool as read-only, non-destructive, idempotent, and open-world.
    export const READ_ONLY_PUBLIC_API = {
      readOnlyHint: true,
      destructiveHint: false,
      idempotentHint: true,
      openWorldHint: true,
    } as const;
Behavior5/5

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

The description adds behavioral context beyond annotations: caching for 1 hour, meaning of the date field, and that rates only change every 6 weeks. Annotations already indicate read-only and idempotent traits; no contradictions.

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?

The description is well-structured with sections, front-loads the purpose, and adds necessary context. Slightly verbose but each sentence adds value.

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 zero parameters and no output schema, the description fully covers what the tool returns, caching behavior, usage notes, and relationship to sibling tools. Complete for the tool's complexity.

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?

The input schema has no parameters, so the description does not need to add parameter meanings. Baseline is 4 for zero parameters.

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

Purpose5/5

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

The description clearly states that the tool fetches the three ECB key interest rates from the ECB Statistical Data Warehouse. It explicitly lists the returned rates and distinguishes from siblings like get_euro_exchange and get_eu_inflation.

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

Usage Guidelines5/5

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

The description provides explicit when to use (ECB policy rates), when not to use (not for real-time market rates or forex), and suggests using with inflation for real interest rate calculation. It also mentions the update frequency.

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