Skip to main content
Glama
lcfranca

Frankfurter Forex MCP

by lcfranca

base_quote

Retrieve current exchange rates from a base currency to multiple target currencies using the Frankfurter Forex MCP server.

Instructions

Get latest exchange rates from one base currency to multiple target currencies.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseYes
targetsYes

Implementation Reference

  • Core handler function that executes the base_quote tool. Calls Frankfurter API's latest endpoint, validates response payload, extracts rates for target currencies, and returns structured output.
    async def execute(input_data: BaseQuoteInput, client: FrankfurterClient) -> BaseQuoteOutput:
        payload = await client.latest(base=input_data.base, targets=input_data.targets)
        payload_rates = payload.get("rates", {})
        payload_date = payload.get("date")
    
        if not isinstance(payload_rates, dict):
            raise FrankfurterClientError("Frankfurter API returned malformed rates payload")
        if not isinstance(payload_date, str):
            raise FrankfurterClientError("Frankfurter API returned malformed date payload")
    
        rates: dict[str, float] = {}
        for currency in input_data.targets:
            value = payload_rates.get(currency)
            if value is not None:
                try:
                    rates[currency] = float(value)
                except (TypeError, ValueError) as exc:
                    raise FrankfurterClientError("Frankfurter API returned non-numeric rate") from exc
    
        if not rates:
            raise FrankfurterClientError("Frankfurter API returned no rates for requested targets")
    
        return BaseQuoteOutput(
            base=str(payload.get("base", input_data.base)),
            date=date.fromisoformat(payload_date),
            rates=rates,
        )
  • MCP tool registration with @mcp.tool decorator. Wraps the execute function, creates FrankfurterClient, handles validation errors and upstream errors, returns JSON response.
    @mcp.tool(name="base_quote")
    async def base_quote_tool(base: str, targets: list[str]) -> dict:
        """Get latest exchange rates from one base currency to multiple target currencies."""
        try:
            input_data = BaseQuoteInput(base=base, targets=targets)
            async with FrankfurterClient.from_env() as client:
                output = await base_quote.execute(input_data, client)
            return output.model_dump(mode="json")
        except ValidationError as exc:
            return _to_error(str(exc), tool="base_quote", error_code="validation_error")
        except FrankfurterClientError as exc:
            return _to_error(str(exc), tool="base_quote", error_code="upstream_error")
        except Exception:
            return _to_error(
                "Unexpected internal error",
                tool="base_quote",
                error_code="internal_error",
            )
  • Input validation schema (BaseQuoteInput) with field validators for normalizing currency codes, validating 3-letter ISO 4217 format, deduplicating targets, and ensuring base currency is not in targets.
    class BaseQuoteInput(BaseModel):
        model_config = ConfigDict(str_strip_whitespace=True)
    
        base: str = Field(min_length=3, max_length=3, default="EUR")
        targets: list[str] = Field(min_length=1)
    
        @field_validator("base")
        @classmethod
        def normalize_base(cls, value: str) -> str:
            value = _normalize_currency(value)
            if len(value) != 3 or not value.isalpha():
                raise ValueError("base must be a 3-letter ISO 4217 currency code")
            return value
    
        @field_validator("targets")
        @classmethod
        def normalize_targets(cls, values: list[str]) -> list[str]:
            normalized: list[str] = []
            for value in values:
                currency = _normalize_currency(value)
                if len(currency) != 3 or not currency.isalpha():
                    raise ValueError("targets must contain valid 3-letter ISO 4217 codes")
                normalized.append(currency)
    
            deduplicated = list(dict.fromkeys(normalized))
            if not deduplicated:
                raise ValueError("targets cannot be empty")
            return deduplicated
    
        @model_validator(mode="after")
        def validate_base_not_in_targets(self) -> BaseQuoteInput:
            if self.base in self.targets:
                raise ValueError("base currency must not be included in targets")
            return self
  • Output schema (BaseQuoteOutput) defining the structure of the response with base currency, date, and dictionary of exchange rates.
    class BaseQuoteOutput(BaseModel):
        base: str
        date: date
        rates: dict[str, float]
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves 'latest exchange rates,' implying a read-only operation, but doesn't specify data sources, update frequency, rate limits, error handling, or authentication requirements. For a tool with zero annotation coverage, this leaves critical behavioral traits undocumented.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core functionality. There's no wasted wording, and it directly communicates the tool's purpose without unnecessary details. This is appropriately concise for a simple data retrieval tool.

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

Completeness2/5

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

Given the complexity (2 parameters, no annotations, no output schema), the description is incomplete. It doesn't address parameter details, behavioral traits, or output format. While conciseness is good, the lack of contextual information makes it inadequate for an agent to use the tool effectively without additional assumptions.

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

Parameters2/5

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

Schema description coverage is 0%, meaning the input schema provides no descriptions for parameters. The description mentions 'base currency' and 'target currencies,' which loosely map to the 'base' and 'targets' parameters, but doesn't explain expected formats (e.g., currency codes like USD), constraints, or examples. It adds minimal semantic value beyond what's inferred from parameter names.

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 the tool's purpose: 'Get latest exchange rates from one base currency to multiple target currencies.' It specifies the verb ('Get'), resource ('latest exchange rates'), and scope (one-to-many conversion). However, it doesn't explicitly differentiate from sibling tools like 'convert_currency' or 'exchange_history', which likely handle different aspects of currency data.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus its siblings ('convert_currency' and 'exchange_history'). It doesn't mention alternatives, prerequisites, or exclusions. The agent must infer usage from the tool name and description alone, which is insufficient for clear decision-making.

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/lcfranca/frankfurter-forex-mcp'

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