consultar_taxas_desconto
Query discount rates charged to commercial establishments for payment method operations. Retrieve data by quarter with optional filters to analyze transaction costs.
Instructions
Consulta taxas de desconto cobradas de estabelecimentos comerciais por operações com meios de pagamento.
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:194-215 (schema)Tool schema definition for 'consultar_taxas_desconto', including name, description, and input schema requiring 'trimestre' parameter.{ name: "consultar_taxas_desconto", description: "Consulta taxas de desconto cobradas de estabelecimentos comerciais por operações com meios de pagamento.", 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:398-419 (handler)MCP handler for 'consultar_taxas_desconto' tool in CallToolRequestSchema. Extracts parameters, calls fetchBCBData on 'TaxasDescontoDA' endpoint, and returns JSON data.case "consultar_taxas_desconto": { const { trimestre, top = 100, filtro } = args as { trimestre: string; top?: number; filtro?: string; }; const data = await fetchBCBData(`TaxasDescontoDA(trimestre=@trimestre)?@trimestre='${trimestre}'`, { formato: "json", top, filter: filtro, }); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; }
- src/http-server.ts:184-205 (schema)Tool schema definition for 'consultar_taxas_desconto', including name, description, and input schema requiring 'trimestre' parameter.{ name: "consultar_taxas_desconto", description: "Consulta taxas de desconto cobradas de estabelecimentos comerciais por operações com meios de pagamento.", 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:402-423 (handler)MCP handler for 'consultar_taxas_desconto' tool in CallToolRequestSchema within createMCPServer function. Fetches data from BCB API.case "consultar_taxas_desconto": { const { trimestre, top = 100, filtro } = args as { trimestre: string; top?: number; filtro?: string; }; const data = await fetchBCBData(`TaxasDescontoDA(trimestre=@trimestre)?@trimestre='${trimestre}'`, { formato: "json", top, filter: filtro, }); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; }
- src/index.ts:37-51 (helper)Helper function to fetch data from the BCB Olinda API, used by all tool handlers including 'consultar_taxas_desconto'.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; }