Skip to main content
Glama

cambio-currencies-list

Access a comprehensive list of available currencies for exchange rate data through the Brasil API MCP, enabling reliable currency information retrieval for integration into applications.

Instructions

List all available currencies for exchange rates

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": {}, "type": "object" }

Implementation Reference

  • Registration of the "cambio-currencies-list" tool, including its description, empty input schema, and the inline handler function that fetches the list of currencies from the Brasil API and formats them into a readable text response.
    server.tool( "cambio-currencies-list", "List all available currencies for exchange rates", {}, async () => { console.error("Listing all available currencies"); const result = await getBrasilApiData(`/cambio/v1/moedas`); if (!result.success) { return formatErrorResponse(`Error listing currencies: ${result.message}`); } // Format the response data const currencies = result.data; const formattedCurrencies = currencies.map((currency: any) => `${currency.simbolo} - ${currency.nome} (Type: ${currency.tipo_moeda})` ).join("\n"); return { content: [{ type: "text" as const, text: `Available Currencies:\n${formattedCurrencies}` }] }; } );
  • API client helper function used by the tool handler to make HTTP GET requests to the Brasil API and handle responses or errors in a standardized format.
    export async function getBrasilApiData(endpoint: string, params: Record<string, any> = {}) { try { const url = `${BASE_URL}${endpoint}`; console.error(`Making request to: ${url}`); const response = await axios.get(url, { params }); return { data: response.data, success: true }; } catch (error: any) { console.error(`Error in API request: ${error.message}`); // Handle API errors in a structured format if (error.response) { return { success: false, statusCode: error.response.status, message: error.response.data?.message || error.message, error: error.response.data }; } return { success: false, message: error.message, error }; } }
  • Utility function to format error messages into the MCP-compatible response structure, used in the tool handler for error cases.
    export function formatErrorResponse(message: string) { return { content: [{ type: "text" as const, text: message }], isError: true }; }

Other Tools

Related 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/guilhermelirio/brasil-api-mcp'

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