consultar_taxas_intercambio
Query Brazil's Central Bank interchange rates for payment methods by quarter to analyze market pricing and transaction costs.
Instructions
Consulta taxas de intercâmbio praticadas no mercado de meios de pagamento por trimestre.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| trimestre | Yes | Ano e trimestre no formato YYYYQ (exemplo: '20234') | |
| top | No | Número máximo de registros a retornar (padrão: 100) | |
| filtro | No | Filtro OData para refinar a consulta |
Implementation Reference
- src/index.ts:375-396 (handler)Main handler for the 'consultar_taxas_intercambio' tool in the stdio MCP server. Extracts parameters, calls fetchBCBData with the specific BCB API endpoint 'TaxasIntercambioDA', and returns JSON-formatted data.case "consultar_taxas_intercambio": { const { trimestre, top = 100, filtro } = args as { trimestre: string; top?: number; filtro?: string; }; const data = await fetchBCBData(`TaxasIntercambioDA(trimestre=@trimestre)?@trimestre='${trimestre}'`, { formato: "json", top, filter: filtro, }); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; }
- src/index.ts:172-193 (schema)Input schema definition for the 'consultar_taxas_intercambio' tool, including required 'trimestre' parameter and optional 'top' and 'filtro'.{ name: "consultar_taxas_intercambio", description: "Consulta taxas de intercâmbio praticadas no mercado de meios de pagamento por trimestre.", inputSchema: { type: "object", properties: { trimestre: { type: "string", description: "Ano e trimestre no formato YYYYQ (exemplo: '20234')", }, top: { type: "number", description: "Número máximo de registros a retornar (padrão: 100)", }, filtro: { type: "string", description: "Filtro OData para refinar a consulta", }, }, required: ["trimestre"], }, },
- src/http-server.ts:379-400 (handler)Handler for the 'consultar_taxas_intercambio' tool in the HTTP/SSE MCP server. Identical logic to index.ts handler.case "consultar_taxas_intercambio": { const { trimestre, top = 100, filtro } = args as { trimestre: string; top?: number; filtro?: string; }; const data = await fetchBCBData(`TaxasIntercambioDA(trimestre=@trimestre)?@trimestre='${trimestre}'`, { formato: "json", top, filter: filtro, }); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; }
- src/http-server.ts:162-182 (schema)Input schema definition for the 'consultar_taxas_intercambio' tool in http-server.ts, identical to index.ts.{ name: "consultar_taxas_intercambio", description: "Consulta taxas de intercâmbio praticadas no mercado de meios de pagamento por trimestre.", inputSchema: { type: "object", properties: { trimestre: { type: "string", description: "Ano e trimestre no formato YYYYQ (exemplo: '20234')", }, top: { type: "number", description: "Número máximo de registros a retornar (padrão: 100)", }, filtro: { type: "string", description: "Filtro OData para refinar a consulta", }, }, required: ["trimestre"], },
- src/index.ts:37-52 (helper)Shared helper function used by all tool handlers, including 'consultar_taxas_intercambio', to fetch data from BCB API.async function fetchBCBData(endpoint: string, params: QueryParams = {}) { try { const url = buildUrl(endpoint, params); const response = await axios.get(url, { headers: { "Accept": "application/json" } }); return response.data; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Erro ao consultar API do BCB: ${error.message}`); } throw error; } }