get_supported_currencies
Retrieve available currency codes for exchange rate calculations using the Frankfurter API.
Instructions
Returns a list of three-letter currency codes for the supported currencies.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/frankfurtermcp/server.py:84-98 (handler)The main handler function for the get_supported_currencies tool. It makes an HTTP GET request to the Frankfurter API's /currencies endpoint to retrieve the list of supported currencies and returns the response content.async def get_supported_currencies(self, ctx: Context): """Returns a list of three-letter currency codes for the supported currencies.""" try: with self.get_httpx_client() as client: await ctx.info(f"Fetching supported currencies from Frankfurter API at {self.frankfurter_api_url}") http_response = client.get(f"{self.frankfurter_api_url}/currencies") http_response.raise_for_status() # Note: The following line could easily be result = http_response.json() but we use content.decode() to # demonstrate the TextContent wrapping capability of the get_response_content utility method. # Questionable choice? Should we just use # pragma: no cover in the respective branch of get_response_content? result = http_response.content.decode() return self.get_response_content(response=result, http_response=http_response) except httpx.RequestError as e: raise ValueError(f"Failed to fetch supported currencies from {self.frankfurter_api_url}. {e}")
- src/frankfurtermcp/server.py:30-37 (registration)Registration entry for the get_supported_currencies tool in the tools list of the FrankfurterMCP class, specifying the function name, tags, and annotations.{ "fn": "get_supported_currencies", "tags": ["currency-rates", "supported-currencies"], "annotations": { "readOnlyHint": True, "openWorldHint": True, }, },