bcb-br-mcp 1.3.4 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,YAAY,kDAAkD,CAAC;AAE5E,eAAO,MAAM,MAAM;;;;CAIlB,CAAC;AAGF,eAAO,MAAM,aAAa;;;;CAIzB,CAAC;AAaF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEtD;AAED,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAID,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,W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AAC;CACd;AAED,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,EAgBhD,CAAC;AAIF,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,SAAS,CAAC,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC,CAmCrB"}
package/dist/tools.js CHANGED
@@ -1,52 +1,21 @@
1
1
  /**
2
- * BCB BR MCP Server — Shared Tools Logic
3
- * Extracted from index.ts to be shared between stdio (index.ts) and HTTP (worker.ts) transports.
2
+ * BCB BR MCP Server — tools do SGS + montagem do catálogo canônico de tools.
3
+ *
4
+ * Os primitivos (fetch, config, versão, tipos, `sealDeep`) moraram aqui até a
5
+ * sessão de D3 e foram para `shared.ts` quando o servidor passou a falar com
6
+ * três APIs. Este módulo os RE-EXPORTA porque o worker, os testes e o
7
+ * `register.ts` importam desses nomes daqui desde a fundação.
4
8
  *
5
9
  * Author: Sidney Bissoli
6
10
  * License: MIT
7
11
  */
12
+ import { obterCatalogo, buscarSeries } from "./catalog.js";
13
+ import { FOCUS_TOOL_DEFINITIONS, dispatchFocusTool } from "./focus.js";
14
+ import { CAMBIO_TOOL_DEFINITIONS, dispatchCambioTool } from "./cambio.js";
15
+ import { calculateVariation, fetchBcbApi, formatDateForApi, normalizeString, sealDeep, structuredResult } from "./shared.js";
16
+ export { CONFIG, WORKER_CONFIG, calculateVariation, erroResult, fetchBcbApi, fetchWithTimeout, formatDateForApi, getUserAgent, mensagemDeErro, normalizeString, sealDeep, setServerVersion, sleep, structuredResult } from "./shared.js";
8
17
  // ==================== CONSTANTS ====================
9
18
  export const BCB_API_BASE = "https://api.bcb.gov.br/dados/serie/bcdata.sgs";
10
- export const CONFIG = {
11
- TIMEOUT_MS: 30000,
12
- MAX_RETRIES: 3,
13
- RETRY_DELAY_MS: 1000
14
- };
15
- // Worker uses shorter timeout (Cloudflare has its own limits)
16
- export const WORKER_CONFIG = {
17
- TIMEOUT_MS: 10000,
18
- MAX_RETRIES: 2,
19
- RETRY_DELAY_MS: 1000
20
- };
21
- // ==================== VERSION (single source of truth) ====================
22
- //
23
- // tools.ts runs under two builds that resolve package.json differently, so the
24
- // version is injected by each entry point instead of imported here:
25
- // - index.ts (Node/stdio) reads it via createRequire and calls setServerVersion()
26
- // - worker.ts (Cloudflare) reads it via a JSON import inlined by esbuild and calls it too
27
- // A static `import "../package.json"` is avoided on purpose: it breaks tsc's rootDir
28
- // and createRequire is unavailable in the Worker runtime (no nodejs_compat).
29
- // The fallback is only used if no entry point injects a version; keep it = package.json.
30
- let serverVersion = "1.3.4";
31
- export function setServerVersion(version) {
32
- serverVersion = version;
33
- }
34
- export function getUserAgent() {
35
- return `bcb-br-mcp/${serverVersion}`;
36
- }
37
- // ==================== OUTPUT HELPER ====================
38
- /**
39
- * Builds a ToolResult that satisfies an MCP tool's outputSchema:
40
- * the same payload is exposed as machine-readable structuredContent and,
41
- * for backward compatibility, serialized into a TextContent block.
42
- */
43
- function structuredResult(payload) {
44
- return {
45
- content: [{ type: "text", text: JSON.stringify(payload, null, 2) }],
46
- structuredContent: payload
47
- };
48
- }
49
- // ==================== SERIES CATALOG ====================
50
19
  export const SERIES_POPULARES = [
51
20
  // ==================== JUROS E TAXAS ====================
52
21
  { codigo: 11, nome: "Taxa de juros - Selic acumulada no mês", categoria: "Juros", periodicidade: "Mensal" },
@@ -230,76 +199,6 @@ export const SERIES_POPULARES = [
230
199
  { codigo: 29039, nome: "Expectativa Câmbio - Mediana - Ano corrente", categoria: "Expectativas", periodicidade: "Semanal" },
231
200
  { codigo: 29040, nome: "Expectativa Câmbio - Mediana - Próximo ano", categoria: "Expectativas", periodicidade: "Semanal" }
232
201
  ];
233
- // ==================== UTILITY FUNCTIONS ====================
234
- export function normalizeString(str) {
235
- return str
236
- .toLowerCase()
237
- .normalize("NFD")
238
- .replace(/[\u0300-\u036f]/g, "");
239
- }
240
- export function formatDateForApi(dateStr) {
241
- if (dateStr.includes("-")) {
242
- const [year, month, day] = dateStr.split("-");
243
- return `${day}/${month}/${year}`;
244
- }
245
- return dateStr;
246
- }
247
- export function sleep(ms) {
248
- return new Promise(resolve => setTimeout(resolve, ms));
249
- }
250
- export async function fetchWithTimeout(url, timeoutMs) {
251
- const controller = new AbortController();
252
- const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
253
- try {
254
- const response = await fetch(url, {
255
- signal: controller.signal,
256
- headers: {
257
- "Accept": "application/json",
258
- "User-Agent": getUserAgent()
259
- }
260
- });
261
- return response;
262
- }
263
- finally {
264
- clearTimeout(timeoutId);
265
- }
266
- }
267
- export async function fetchBcbApi(url, timeoutMs = CONFIG.TIMEOUT_MS, maxRetries = CONFIG.MAX_RETRIES) {
268
- let lastError = null;
269
- for (let attempt = 1; attempt <= maxRetries; attempt++) {
270
- try {
271
- const response = await fetchWithTimeout(url, timeoutMs);
272
- if (!response.ok) {
273
- if (response.status === 404) {
274
- throw new Error(`Série não encontrada ou sem dados para o período solicitado`);
275
- }
276
- throw new Error(`Erro na API do BCB: ${response.status} ${response.statusText}`);
277
- }
278
- return response.json();
279
- }
280
- catch (error) {
281
- lastError = error instanceof Error ? error : new Error(String(error));
282
- if (lastError.message.includes("não encontrada")) {
283
- throw lastError;
284
- }
285
- const isTimeout = lastError.name === "AbortError" ||
286
- lastError.message.includes("aborted") ||
287
- lastError.message.includes("timeout");
288
- if (attempt < maxRetries) {
289
- const delayMs = CONFIG.RETRY_DELAY_MS * Math.pow(2, attempt - 1);
290
- const reason = isTimeout ? "timeout" : "erro";
291
- console.error(`Tentativa ${attempt}/${maxRetries} falhou (${reason}). Aguardando ${delayMs}ms...`);
292
- await sleep(delayMs);
293
- }
294
- }
295
- }
296
- throw new Error(`Falha após ${maxRetries} tentativas: ${lastError?.message || "Erro desconhecido"}`);
297
- }
298
- export function calculateVariation(valorInicial, valorFinal) {
299
- if (valorInicial === 0)
300
- return 0;
301
- return ((valorFinal - valorInicial) / Math.abs(valorInicial)) * 100;
302
- }
303
202
  // ==================== TOOL HANDLERS ====================
304
203
  export async function handleSerieValores(args, timeoutMs, maxRetries) {
305
204
  try {
@@ -452,21 +351,51 @@ export async function handleSeriesPopulares(args) {
452
351
  };
453
352
  }
454
353
  }
455
- export async function handleBuscarSerie(args) {
354
+ /**
355
+ * Busca real: catálogo curado (camada de destaque) + índice do Portal de Dados
356
+ * Abertos do BCB, servido de cache de 24 h com renovação bloqueante (ver
357
+ * `catalog.ts`). A tool NUNCA afirma que uma série não existe: o índice cobre os
358
+ * datasets do portal nomeados por código, que não são o SGS inteiro.
359
+ */
360
+ export async function handleBuscarSerie(args, timeoutMs, maxRetries) {
456
361
  try {
457
- const termoNorm = normalizeString(args.termo);
458
- const encontradas = SERIES_POPULARES.filter(s => normalizeString(s.nome).includes(termoNorm) ||
459
- normalizeString(s.categoria).includes(termoNorm));
460
- if (encontradas.length === 0) {
461
- return structuredResult({
462
- termo: args.termo,
463
- totalEncontradas: 0,
464
- series: [],
465
- mensagem: "Nenhuma série encontrada no catálogo interno. Use o portal SGS do BCB para buscar outras séries: https://www3.bcb.gov.br/sgspub/",
466
- sugestao: "Tente termos como: selic, ipca, dolar, cambio, pib, inflacao, credito, emprego"
467
- });
362
+ const limite = args.limite ?? 20;
363
+ const { snapshot, aviso } = await obterCatalogo(timeoutMs, maxRetries);
364
+ const { total, series } = buscarSeries(args.termo, SERIES_POPULARES, snapshot?.entradas ?? null, limite);
365
+ const catalogo = snapshot
366
+ ? {
367
+ origem: "Portal de Dados Abertos do BCB (CKAN) + catálogo curado local",
368
+ obtidoEm: snapshot.obtidoEm,
369
+ seriesIndexadas: snapshot.entradas.length,
370
+ cobertura: `O índice cobre ${snapshot.entradas.length} séries identificadas por código no portal de dados ` +
371
+ "abertos, o que NÃO é o SGS inteiro (o portal SGS expõe mais séries). Não encontrar aqui não " +
372
+ "significa que a série não exista: confirme em https://www3.bcb.gov.br/sgspub/ ou consulte o " +
373
+ "código diretamente com bcb_serie_metadados."
374
+ }
375
+ : {
376
+ origem: "catálogo curado local",
377
+ seriesIndexadas: SERIES_POPULARES.length,
378
+ cobertura: `A busca usou apenas o catálogo curado (${SERIES_POPULARES.length} séries) porque o índice do ` +
379
+ "portal de dados abertos não estava disponível. Não encontrar aqui não significa que a série não " +
380
+ "exista: confirme em https://www3.bcb.gov.br/sgspub/."
381
+ };
382
+ const payload = {
383
+ termo: args.termo,
384
+ totalEncontradas: total,
385
+ series,
386
+ catalogo
387
+ };
388
+ if (series.length < total)
389
+ payload.observacao = `Exibindo ${series.length} de ${total} séries; aumente 'limite' ou refine o termo.`;
390
+ if (aviso)
391
+ payload.avisos = [aviso];
392
+ if (total === 0) {
393
+ payload.mensagem =
394
+ "Nenhuma série casou com o termo no catálogo curado nem no índice do portal de dados abertos. " +
395
+ "Isso não é prova de inexistência — veja 'catalogo.cobertura'.";
396
+ payload.sugestao = "Tente termos mais gerais (selic, ipca, dolar, cambio, pib, credito, emprego) ou o código da série.";
468
397
  }
469
- return structuredResult({ termo: args.termo, totalEncontradas: encontradas.length, series: encontradas });
398
+ return structuredResult(payload);
470
399
  }
471
400
  catch (error) {
472
401
  return {
@@ -687,14 +616,21 @@ export const TOOL_DESCRIPTIONS = {
687
616
  "Retorna: `totalSeries`, `categorias` (nº de categorias) e `series` — objeto agrupado por categoria " +
688
617
  "quando sem filtro, ou array plano quando filtrado por categoria; cada item tem codigo, nome, " +
689
618
  "categoria e periodicidade. Catálogo local: não faz chamada de rede.",
690
- bcb_buscar_serie: "Busca séries no catálogo interno curado por nome ou categoria, ignorando acentos e maiúsculas " +
691
- "(ex.: 'inflacao' encontra 'Inflação'; 'dolar' encontra 'Dólar'). " +
692
- "Quando usar: para encontrar o código de uma série a partir de uma palavra-chave (selic, ipca, " +
693
- "cambio, pib, emprego, credito...). Quando NÃO usar: para listar tudo por categoria use " +
694
- "bcb_series_populares. Limitação: pesquisa apenas o catálogo curado (150+ séries), não o SGS " +
695
- "completo (dezenas de milhares); quando nada é encontrado, retorna sugestões e o link do portal SGS. " +
696
- "Retorna: `termo`, `totalEncontradas`, `series` (array de {codigo, nome, categoria, periodicidade}) " +
697
- "e, quando vazio, `mensagem` e `sugestao`. Catálogo local: não faz chamada de rede.",
619
+ bcb_buscar_serie: "Busca séries do BCB por palavra-chave (ou pelo código) em DUAS camadas: o catálogo curado local de " +
620
+ "150+ séries, que vem primeiro e com nome revisado, e o índice do Portal de Dados Abertos do BCB, " +
621
+ "com milhares de séries identificadas por código. Ignora acentos e maiúsculas ('inflacao' encontra " +
622
+ "'Inflação'); vários termos são combinados com E ('ipca servicos'). " +
623
+ "Quando usar: para descobrir o código de uma série antes de consultar valores. Quando NÃO usar: para " +
624
+ "navegar tudo por categoria use bcb_series_populares; para valores use bcb_serie_valores. " +
625
+ "Retorna: `termo`, `totalEncontradas`, `series` (cada item com codigo, nome, origem — 'curado' ou " +
626
+ "'indice' — e, no índice, `dataset` com a página do portal), `catalogo` (origem, obtidoEm, " +
627
+ "seriesIndexadas, cobertura) e, quando aplicável, `observacao`, `avisos`, `mensagem` e `sugestao`. " +
628
+ "Cobertura: o índice NÃO é o SGS inteiro, portanto não encontrar aqui não prova que a série não " +
629
+ "exista — o campo `catalogo.cobertura` diz isso explicitamente em toda resposta. " +
630
+ "Comportamento de rede: o índice é servido de cache com validade de 24 h e a renovação é feita pela " +
631
+ "primeira busca após o vencimento (uma requisição ao portal, ~1 s); as demais buscas não tocam a rede. " +
632
+ "Se o portal estiver fora, a busca degrada para o catálogo curado (ou para o último índice obtido) e " +
633
+ "sinaliza em `avisos`, sempre com a data de obtenção visível.",
698
634
  bcb_indicadores_atuais: "Atalho que retorna, em uma única chamada, o valor mais recente dos principais indicadores da " +
699
635
  "economia brasileira: Selic anualizada, IPCA mensal, IPCA acumulado 12 meses, Dólar PTAX (venda) " +
700
636
  "e IBC-Br. Não recebe parâmetros. " +
@@ -721,8 +657,17 @@ export const TOOL_DESCRIPTIONS = {
721
657
  "`erros`. Resiliente: séries sem dados no período são isoladas em `erros` sem invalidar a comparação. " +
722
658
  BEHAVIOR_NOTE
723
659
  };
724
- // ==================== TOOL DEFINITIONS (for worker JSON-RPC) ====================
725
- export const TOOL_DEFINITIONS = [
660
+ // ==================== TOOL DEFINITIONS (canonical, both transports) ====================
661
+ //
662
+ // Since the SDK v2 migration these JSON Schemas are the SINGLE advertised
663
+ // surface: `src/register.ts` hands them to the SDK verbatim (via
664
+ // `fromJsonSchema` + a permissive validator) for both stdio and the Worker.
665
+ // Before, stdio derived its schemas from Zod and the Worker used this list,
666
+ // so the two transports advertised different contracts — see
667
+ // `baselines/README.md`. Zod stays as the runtime validator inside handlers
668
+ // (that is what produces the pedagogical error results); it is no longer the
669
+ // source of the published schema.
670
+ const RAW_TOOL_DEFINITIONS = [
726
671
  {
727
672
  name: "bcb_serie_valores",
728
673
  description: TOOL_DESCRIPTIONS.bcb_serie_valores,
@@ -769,7 +714,13 @@ export const TOOL_DEFINITIONS = [
769
714
  type: "object",
770
715
  properties: {
771
716
  codigo: { type: "number", description: "Código da série no SGS/BCB" },
772
- quantidade: { type: "number", description: "Quantidade de valores a retornar (1-1000, padrão: 10)" }
717
+ quantidade: {
718
+ type: "number",
719
+ description: "Quantidade de valores a retornar (1-1000, padrão: 10)",
720
+ default: 10,
721
+ minimum: 1,
722
+ maximum: 1000
723
+ }
773
724
  },
774
725
  required: ["codigo"]
775
726
  },
@@ -840,8 +791,15 @@ export const TOOL_DEFINITIONS = [
840
791
  properties: {
841
792
  totalSeries: { type: "number", description: "Quantidade total de séries retornadas" },
842
793
  categorias: { type: "number", description: "Quantidade de categorias distintas" },
794
+ // União modelada de verdade: array plano quando há filtro de categoria,
795
+ // objeto agrupado por categoria quando não há. Descrever em prosa sem
796
+ // o `anyOf` deixaria o cliente sem contrato para o caso agrupado.
843
797
  series: {
844
- description: "Séries encontradas. Objeto agrupado por categoria quando sem filtro; array plano quando filtrado por categoria. Cada item contém codigo, nome, categoria e periodicidade."
798
+ description: "Séries encontradas. Objeto agrupado por categoria quando sem filtro; array plano quando filtrado por categoria.",
799
+ anyOf: [
800
+ { type: "array", items: SERIE_REF_SCHEMA },
801
+ { type: "object", additionalProperties: { type: "array", items: SERIE_REF_SCHEMA } }
802
+ ]
845
803
  },
846
804
  observacao: { type: "string", description: "Dica de uso" }
847
805
  },
@@ -856,12 +814,25 @@ export const TOOL_DEFINITIONS = [
856
814
  readOnlyHint: true,
857
815
  destructiveHint: false,
858
816
  idempotentHint: true,
859
- openWorldHint: false
817
+ // Passou a true na sessão de D3: a busca deixou de ser puramente local e
818
+ // consulta o índice do portal de dados abertos (com cache de 24 h).
819
+ openWorldHint: true
860
820
  },
861
821
  inputSchema: {
862
822
  type: "object",
863
823
  properties: {
864
- termo: { type: "string", description: "Termo de busca (mínimo 2 caracteres)" }
824
+ termo: {
825
+ type: "string",
826
+ description: "Termo de busca (mínimo 2 caracteres) ou o código da série. Vários termos são combinados com E.",
827
+ minLength: 2
828
+ },
829
+ limite: {
830
+ type: "number",
831
+ description: "Máximo de séries a devolver (1-100, padrão: 20). `totalEncontradas` traz o total antes do corte.",
832
+ default: 20,
833
+ minimum: 1,
834
+ maximum: 100
835
+ }
865
836
  },
866
837
  required: ["termo"]
867
838
  },
@@ -869,25 +840,48 @@ export const TOOL_DEFINITIONS = [
869
840
  type: "object",
870
841
  properties: {
871
842
  termo: { type: "string", description: "Termo pesquisado" },
872
- totalEncontradas: { type: "number", description: "Quantidade de séries encontradas" },
843
+ totalEncontradas: { type: "number", description: "Quantidade de séries encontradas, antes do corte por `limite`" },
873
844
  series: {
874
845
  type: "array",
875
- description: "Séries que correspondem ao termo",
846
+ description: "Séries que correspondem ao termo — as do catálogo curado primeiro",
876
847
  items: {
877
848
  type: "object",
878
849
  properties: {
879
- codigo: { type: "number" },
880
- nome: { type: "string" },
881
- categoria: { type: "string" },
882
- periodicidade: { type: "string" }
850
+ codigo: { type: "number", description: "Código da série no SGS/BCB" },
851
+ nome: { type: "string", description: "Nome da série (revisado quando `origem` = curado; derivado do slug do portal quando = indice)" },
852
+ categoria: { type: "string", description: "Categoria econômica (só no catálogo curado)" },
853
+ periodicidade: { type: "string", description: "Periodicidade (só no catálogo curado)" },
854
+ origem: {
855
+ type: "string",
856
+ enum: ["curado", "indice"],
857
+ description: "Camada de onde veio o achado"
858
+ },
859
+ dataset: { type: "string", description: "Página do dataset no portal de dados abertos (só quando `origem` = indice)" }
883
860
  },
884
- required: ["codigo", "nome"]
861
+ required: ["codigo", "nome", "origem"]
885
862
  }
886
863
  },
864
+ catalogo: {
865
+ type: "object",
866
+ description: "Proveniência do índice usado na busca",
867
+ properties: {
868
+ origem: { type: "string", description: "Camadas consultadas" },
869
+ obtidoEm: { type: "string", description: "Timestamp ISO 8601 em que o índice do portal foi obtido" },
870
+ seriesIndexadas: { type: "number", description: "Quantidade de séries no índice consultado" },
871
+ cobertura: { type: "string", description: "Limite explícito de cobertura do índice" }
872
+ },
873
+ required: ["origem", "seriesIndexadas", "cobertura"]
874
+ },
875
+ observacao: { type: "string", description: "Aviso de corte quando há mais resultados que `limite`" },
876
+ avisos: {
877
+ type: "array",
878
+ description: "Avisos de degradação (índice vencido ou indisponível)",
879
+ items: { type: "string" }
880
+ },
887
881
  mensagem: { type: "string", description: "Mensagem exibida quando nada é encontrado" },
888
882
  sugestao: { type: "string", description: "Sugestões de termos alternativos" }
889
883
  },
890
- required: ["termo", "totalEncontradas", "series"]
884
+ required: ["termo", "totalEncontradas", "series", "catalogo"]
891
885
  }
892
886
  },
893
887
  {
@@ -941,8 +935,14 @@ export const TOOL_DEFINITIONS = [
941
935
  type: "object",
942
936
  properties: {
943
937
  codigo: { type: "number", description: "Código da série no SGS/BCB" },
944
- dataInicial: { type: "string", description: "Data inicial (yyyy-MM-dd ou dd/MM/yyyy)" },
945
- dataFinal: { type: "string", description: "Data final (yyyy-MM-dd ou dd/MM/yyyy)" },
938
+ dataInicial: {
939
+ type: "string",
940
+ description: "Data inicial (yyyy-MM-dd ou dd/MM/yyyy). Se não informada, usa o primeiro valor disponível."
941
+ },
942
+ dataFinal: {
943
+ type: "string",
944
+ description: "Data final (yyyy-MM-dd ou dd/MM/yyyy). Se não informada, usa o último valor disponível."
945
+ },
946
946
  periodos: { type: "number", description: "Alternativa: calcular variação dos últimos N períodos (ignora datas se informado)" }
947
947
  },
948
948
  required: ["codigo"]
@@ -980,7 +980,8 @@ export const TOOL_DEFINITIONS = [
980
980
  variacaoPercentual: { type: "number" },
981
981
  variacaoFormatada: { type: "string" }
982
982
  },
983
- required: ["valorInicial", "valorFinal", "variacaoPercentual"]
983
+ // O handler sempre devolve os cinco campos — o contrato reflete isso.
984
+ required: ["valorInicial", "valorFinal", "diferencaAbsoluta", "variacaoPercentual", "variacaoFormatada"]
984
985
  },
985
986
  estatisticas: {
986
987
  type: "object",
@@ -1010,7 +1011,13 @@ export const TOOL_DEFINITIONS = [
1010
1011
  inputSchema: {
1011
1012
  type: "object",
1012
1013
  properties: {
1013
- codigos: { type: "array", items: { type: "number" }, description: "Array com 2 a 5 códigos de séries para comparar" },
1014
+ codigos: {
1015
+ type: "array",
1016
+ items: { type: "number" },
1017
+ description: "Array com 2 a 5 códigos de séries para comparar",
1018
+ minItems: 2,
1019
+ maxItems: 5
1020
+ },
1014
1021
  dataInicial: { type: "string", description: "Data inicial (yyyy-MM-dd ou dd/MM/yyyy)" },
1015
1022
  dataFinal: { type: "string", description: "Data final (yyyy-MM-dd ou dd/MM/yyyy)" }
1016
1023
  },
@@ -1068,12 +1075,84 @@ export const TOOL_DEFINITIONS = [
1068
1075
  }
1069
1076
  }
1070
1077
  },
1071
- required: ["periodo", "totalSeries", "seriesComDados", "seriesComErro", "ranking"]
1078
+ required: ["periodo", "totalSeries", "seriesComDados", "seriesComErro", "ranking", "erros"]
1072
1079
  }
1073
1080
  }
1074
1081
  ];
1082
+ /**
1083
+ * Catálogo canônico das tools, na ordem em que o `tools/list` publica: primeiro
1084
+ * as 8 do SGS (ordem preservada desde a fundação — mexer nela move a superfície
1085
+ * sem motivo), depois as 3 do Focus e as 2 de câmbio, que a sessão de D3
1086
+ * acrescentou. O selo (`additionalProperties: false`) é aplicado num lugar só,
1087
+ * para todas.
1088
+ */
1089
+ export const TOOL_DEFINITIONS = [
1090
+ ...RAW_TOOL_DEFINITIONS,
1091
+ ...FOCUS_TOOL_DEFINITIONS,
1092
+ ...CAMBIO_TOOL_DEFINITIONS
1093
+ ].map(tool => ({
1094
+ ...tool,
1095
+ inputSchema: sealDeep(tool.inputSchema),
1096
+ outputSchema: sealDeep(tool.outputSchema)
1097
+ }));
1098
+ export const CODIGOS_PRINCIPAIS = {
1099
+ juros: { selic_meta: 1178, selic_acumulada: 432, cdi: 4389, tr: 226 },
1100
+ inflacao: { ipca_mensal: 433, ipca_12m: 13522, igpm: 189, inpc: 188 },
1101
+ cambio: { dolar_venda: 1, dolar_ptax: 3698, euro: 21619 },
1102
+ atividade: { pib_mensal: 4380, ibc_br: 24364 },
1103
+ emprego: { desemprego: 24369, rendimento_medio: 24380 },
1104
+ fiscal: { divida_bruta: 4513, divida_liquida: 4503, resultado_primario: 4537 }
1105
+ };
1106
+ export const RESOURCE_DEFINITIONS = [
1107
+ {
1108
+ name: "series_populares",
1109
+ uri: "bcb://series/populares",
1110
+ description: "Catálogo de 150+ séries econômicas populares do BCB organizadas por categoria",
1111
+ mimeType: "application/json",
1112
+ read: () => JSON.stringify(SERIES_POPULARES, null, 2)
1113
+ },
1114
+ {
1115
+ name: "categorias",
1116
+ uri: "bcb://series/categorias",
1117
+ description: "Lista de categorias disponíveis no catálogo de séries do BCB",
1118
+ mimeType: "application/json",
1119
+ read: () => JSON.stringify([...new Set(SERIES_POPULARES.map(s => s.categoria))].sort(), null, 2)
1120
+ },
1121
+ {
1122
+ name: "codigos_principais",
1123
+ uri: "bcb://series/principais",
1124
+ description: "Códigos dos indicadores econômicos mais utilizados (Selic, IPCA, Dólar, PIB, etc.)",
1125
+ mimeType: "application/json",
1126
+ read: () => JSON.stringify(CODIGOS_PRINCIPAIS, null, 2)
1127
+ }
1128
+ ];
1129
+ export const PROMPT_DEFINITIONS = [
1130
+ {
1131
+ name: "indicadores_atuais",
1132
+ description: "Consulta os principais indicadores econômicos do Brasil (Selic, IPCA, Dólar, IBC-Br)",
1133
+ text: "Consulte os indicadores econômicos atuais do Brasil usando a ferramenta bcb_indicadores_atuais e apresente os resultados de forma clara e organizada."
1134
+ },
1135
+ {
1136
+ name: "panorama_economico",
1137
+ description: "Gera um panorama completo da economia brasileira com os principais indicadores",
1138
+ text: "Faça um panorama completo da economia brasileira. Use bcb_indicadores_atuais para obter Selic, IPCA, Dólar e IBC-Br. Depois use bcb_serie_ultimos para consultar os últimos 3 valores da taxa de desemprego (código 24369) e da dívida bruta (código 4513). Apresente tudo de forma organizada com análise breve."
1139
+ },
1140
+ {
1141
+ name: "comparar_inflacao",
1142
+ description: "Compara os principais índices de inflação do Brasil (IPCA, IGP-M, INPC) nos últimos 12 meses",
1143
+ text: "Compare os principais índices de inflação do Brasil nos últimos 12 meses. Use bcb_serie_ultimos com quantidade 12 para IPCA (código 433), IGP-M (código 189) e INPC (código 188). Apresente uma tabela comparativa e análise das tendências."
1144
+ }
1145
+ ];
1075
1146
  // ==================== TOOL DISPATCHER (for worker) ====================
1076
1147
  export async function dispatchTool(toolName, args, timeoutMs, maxRetries) {
1148
+ // As tools das outras duas APIs despacham nos próprios módulos; cada um
1149
+ // devolve null quando a tool não é dele, e o SGS segue abaixo.
1150
+ const focus = dispatchFocusTool(toolName, args, timeoutMs, maxRetries);
1151
+ if (focus)
1152
+ return focus;
1153
+ const cambio = dispatchCambioTool(toolName, args, timeoutMs, maxRetries);
1154
+ if (cambio)
1155
+ return cambio;
1077
1156
  switch (toolName) {
1078
1157
  case "bcb_serie_valores":
1079
1158
  return handleSerieValores(args, timeoutMs, maxRetries);
@@ -1084,7 +1163,7 @@ export async function dispatchTool(toolName, args, timeoutMs, maxRetries) {
1084
1163
  case "bcb_series_populares":
1085
1164
  return handleSeriesPopulares(args);
1086
1165
  case "bcb_buscar_serie":
1087
- return handleBuscarSerie(args);
1166
+ return handleBuscarSerie(args, timeoutMs, maxRetries);
1088
1167
  case "bcb_indicadores_atuais":
1089
1168
  return handleIndicadoresAtuais({}, timeoutMs, maxRetries);
1090
1169
  case "bcb_variacao":