fin-app-mcp 2.3.2 → 2.3.4
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.
- package/index.mjs +395 -38
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -367,6 +367,11 @@ CAMPOS:
|
|
|
367
367
|
- current_installment: number — parcela inicial (default: 1). Passar 1 é equivalente ao default — o sistema cria todas as N parcelas começando da primeira. Use valores > 1 APENAS quando registrando uma compra parcelada que já está em andamento e você quer criar apenas as parcelas futuras (ex: installments=10, current_installment=3 cria 8 transações, da parcela 3 à 10).
|
|
368
368
|
- reversal_of_id: string UUID — ID da transação original para estorno.
|
|
369
369
|
- reversal_kind: string — 'full' ou 'partial' (obrigatório quando reversal_of_id é informado).
|
|
370
|
+
- tags: string[] — tags livres pra cortes ortogonais (ex: ["TDAH-tracking", "Lou-shared"]).
|
|
371
|
+
- original_purchase_date: string YYYY-MM-DD — data REAL da compra (use junto com installments>1 e current_installment>1 em cartão para o FIN colocar cada parcela na fatura certa a partir do cutoff do cartão).
|
|
372
|
+
- original_amount_cents: number — valor na moeda estrangeira (ex: 2000 = US$ 20,00). Use quando a despesa foi em USD.
|
|
373
|
+
- original_currency: 'BRL' | 'USD' — moeda de original_amount_cents.
|
|
374
|
+
- exchange_rate_cents_per_unit: number — cotação em 1/10000 (51023 = R$ 5,1023 por 1 USD). Opcional; use quando NÃO passar amount_cents (backend deriva BRL).
|
|
370
375
|
|
|
371
376
|
REGRAS DE NEGÓCIO — ESTORNO:
|
|
372
377
|
- Para estorno em cartão: criar despesa com reversal_of_id = UUID da transação original.
|
|
@@ -385,6 +390,16 @@ REGRAS DE NEGÓCIO — CICLO DE FATURA:
|
|
|
385
390
|
- invoice_cycle_end: força a transação a pertencer a um ciclo de fatura específico, independente da tx_date. Usar quando o banco lista um cancelamento/estorno em uma fatura diferente da compra original. O valor é a data de fechamento do ciclo (YYYY-MM-DD), NÃO o reference_month.
|
|
386
391
|
- Ver seção 8 do guia (fin://docs/guia) para cenários de conciliação complexa.
|
|
387
392
|
|
|
393
|
+
REGRAS DE NEGÓCIO — MULTI-MOEDA (USD):
|
|
394
|
+
- amount_cents é SEMPRE em BRL. Para despesas em USD, pergunte à pessoa: "cotação automática ou valor exato em BRL que saiu?".
|
|
395
|
+
- Conta USD EXIGE original_amount_cents + original_currency: "USD". Passar só amount_cents numa conta USD retorna 422.
|
|
396
|
+
- Modo (a) — pessoa informa o BRL exato: passar amount_cents (BRL) + original_amount_cents + original_currency. O backend grava BRL como fonte da verdade e deriva exchange_rate.
|
|
397
|
+
- Modo (b) — pessoa só sabe a cotação: passar original_amount_cents + original_currency + exchange_rate_cents_per_unit (sem amount_cents). Backend calcula amount_cents = original_amount * rate.
|
|
398
|
+
- Modo (c) — despesa BRL normal: só passar amount_cents.
|
|
399
|
+
|
|
400
|
+
REGRAS DE NEGÓCIO — PARCELAMENTO DE COMPRA ANTIGA:
|
|
401
|
+
- Pra lançar uma compra já em andamento (ex: "Ray-Ban 10x, estou na parcela 4"), passe original_purchase_date (data REAL da compra), installments (10), current_installment (4). O backend usa o cutoff/due_day do cartão pra colocar a parcela 4 na fatura corrente e as próximas nas faturas futuras. SEM esse campo, você precisa passar tx_date como "data da primeira parcela a cair" (anti-intuitivo).
|
|
402
|
+
|
|
388
403
|
EXEMPLO — despesa simples:
|
|
389
404
|
{ "description": "Almoço", "amount_cents": 3500, "account_name": "Nubank", "category_name": "Alimentação" }
|
|
390
405
|
|
|
@@ -395,7 +410,16 @@ EXEMPLO — parcelamento:
|
|
|
395
410
|
{ "description": "Óculos Fozoco", "amount_cents": 36792, "account_name": "Nubank", "category_name": "Saúde", "installments": 4 }
|
|
396
411
|
|
|
397
412
|
EXEMPLO — forçar ciclo:
|
|
398
|
-
{ "description": "Cancelamento GoDaddy", "amount_cents": 59322, "account_name": "Latam Itaú", "category_name": "Tecnologia", "reversal_of_id": "uuid-original", "reversal_kind": "full", "invoice_cycle_end": "2026-05-01" }
|
|
413
|
+
{ "description": "Cancelamento GoDaddy", "amount_cents": 59322, "account_name": "Latam Itaú", "category_name": "Tecnologia", "reversal_of_id": "uuid-original", "reversal_kind": "full", "invoice_cycle_end": "2026-05-01" }
|
|
414
|
+
|
|
415
|
+
EXEMPLO — compra USD com BRL exato (modo a):
|
|
416
|
+
{ "description": "Camiseta NY", "amount_cents": 10200, "original_amount_cents": 2000, "original_currency": "USD", "account_name": "Wise USD", "category_name": "Pessoal", "subcategory_name": "Vestuário" }
|
|
417
|
+
|
|
418
|
+
EXEMPLO — compra USD via cotação (modo b):
|
|
419
|
+
{ "description": "Café", "original_amount_cents": 500, "original_currency": "USD", "exchange_rate_cents_per_unit": 52000, "account_name": "Wise USD", "category_name": "Alimentação" }
|
|
420
|
+
|
|
421
|
+
EXEMPLO — Ray-Ban 10x, parcela 4 em cartão Caixa (compra dez/2025, hoje abril/2026):
|
|
422
|
+
{ "description": "Ray-Ban", "amount_cents": 137000, "account_name": "Caixa Cartão", "category_name": "Pessoal", "subcategory_name": "Acessórios", "installments": 10, "current_installment": 4, "original_purchase_date": "2025-12-23" }`,
|
|
399
423
|
inputSchema: {
|
|
400
424
|
type: "object",
|
|
401
425
|
properties: {
|
|
@@ -426,8 +450,30 @@ EXEMPLO — forçar ciclo:
|
|
|
426
450
|
type: "string",
|
|
427
451
|
description: "YYYY-MM-DD — data de fechamento do ciclo. Força a transação pra uma fatura específica.",
|
|
428
452
|
},
|
|
453
|
+
tags: {
|
|
454
|
+
type: "array",
|
|
455
|
+
items: { type: "string" },
|
|
456
|
+
description: "Tags livres pra cortes ortogonais (max 20).",
|
|
457
|
+
},
|
|
458
|
+
original_purchase_date: {
|
|
459
|
+
type: "string",
|
|
460
|
+
description: "YYYY-MM-DD — data REAL da compra. Use com installments>1 + current_installment>1 em cartão pra colocar cada parcela na fatura certa.",
|
|
461
|
+
},
|
|
462
|
+
original_amount_cents: {
|
|
463
|
+
type: "number",
|
|
464
|
+
description: "Valor em centavos na moeda estrangeira (ex: 2000 = US$ 20,00).",
|
|
465
|
+
},
|
|
466
|
+
original_currency: {
|
|
467
|
+
type: "string",
|
|
468
|
+
enum: ["BRL", "USD"],
|
|
469
|
+
description: "Moeda de original_amount_cents. Use 'USD' pra despesas em dólar.",
|
|
470
|
+
},
|
|
471
|
+
exchange_rate_cents_per_unit: {
|
|
472
|
+
type: "number",
|
|
473
|
+
description: "Cotação em 1/10000: 51023 = R$ 5,1023 por 1 USD. Use quando NÃO passar amount_cents.",
|
|
474
|
+
},
|
|
429
475
|
},
|
|
430
|
-
required: ["description"
|
|
476
|
+
required: ["description"],
|
|
431
477
|
},
|
|
432
478
|
},
|
|
433
479
|
{
|
|
@@ -446,6 +492,7 @@ CAMPOS:
|
|
|
446
492
|
- category_name: string — nome da categoria (deve ser flow 'income').
|
|
447
493
|
- subcategory_name: string — subcategoria.
|
|
448
494
|
- tx_date: string YYYY-MM-DD — data (default: hoje).
|
|
495
|
+
- tags: string[] — tags livres pra cortes ortogonais.
|
|
449
496
|
|
|
450
497
|
REGRAS DE NEGÓCIO:
|
|
451
498
|
- Valores em centavos.
|
|
@@ -459,6 +506,11 @@ REGRAS DE NEGÓCIO:
|
|
|
459
506
|
category_name: { type: "string" },
|
|
460
507
|
subcategory_name: { type: "string" },
|
|
461
508
|
tx_date: { type: "string", description: "YYYY-MM-DD (default: hoje)" },
|
|
509
|
+
tags: {
|
|
510
|
+
type: "array",
|
|
511
|
+
items: { type: "string" },
|
|
512
|
+
description: "Tags livres pra cortes ortogonais (max 20).",
|
|
513
|
+
},
|
|
462
514
|
},
|
|
463
515
|
required: ["description", "amount_cents"],
|
|
464
516
|
},
|
|
@@ -731,60 +783,85 @@ NÃO USAR QUANDO: quiser ver transações gerais (usar fin_todas_transacoes) ou
|
|
|
731
783
|
|
|
732
784
|
CAMPOS:
|
|
733
785
|
- month: string YYYY-MM — mês de referência (default: mês atual).
|
|
786
|
+
- status: string — filtro opcional. Aceita um valor ('pending', 'overdue', 'paid', 'paid_late'), lista separada por vírgula ('pending,overdue'), ou o atalho 'unpaid' (= pending+overdue).
|
|
734
787
|
|
|
735
788
|
REGRAS DE NEGÓCIO:
|
|
736
789
|
- Status: 'pending' (aguardando vencimento), 'overdue' (vencida e não paga), 'paid' (paga no prazo), 'paid_late' (paga em atraso).
|
|
737
790
|
- Ocorrências são geradas automaticamente para cada bill ativa no mês consultado.
|
|
738
791
|
- amount_cents: valor definido para esta ocorrência (null se ainda não definido — usar default_amount_cents da bill).
|
|
739
792
|
- transaction_id: preenchido quando a conta foi paga (link para a transação de despesa).
|
|
793
|
+
- Ocorrências pagas vêm com account_name, category_name, subcategory_name, tx_description, invoice_cycle_end resolvidos via JOIN com a transação.
|
|
794
|
+
- Resposta inclui summary com total_*_cents e count_* por status (agregado sobre o mês inteiro, ignorando status filter).
|
|
740
795
|
- Valores em centavos.
|
|
741
796
|
|
|
742
797
|
EXEMPLO:
|
|
743
798
|
{ "month": "2026-04" }
|
|
799
|
+
{ "month": "2026-04", "status": "unpaid" }
|
|
744
800
|
|
|
745
|
-
Retorno: [{ bill_name: "Light", status: "pending", due_date: "2026-04-01", amount_cents: null }, ...]`,
|
|
801
|
+
Retorno: { summary: {...}, occurrences: [{ bill_name: "Light", status: "pending", due_date: "2026-04-01", amount_cents: null, account_name, category_name, notes }, ...] }`,
|
|
746
802
|
inputSchema: {
|
|
747
803
|
type: "object",
|
|
748
804
|
properties: {
|
|
749
805
|
month: { type: "string", description: "YYYY-MM (default: mês atual)" },
|
|
806
|
+
status: { type: "string", description: "Filtro opcional: 'pending', 'overdue', 'paid', 'paid_late', 'unpaid' (pending+overdue), ou lista separada por vírgula." },
|
|
750
807
|
},
|
|
751
808
|
},
|
|
752
809
|
},
|
|
753
810
|
{
|
|
754
811
|
name: "fin_pagar_bill",
|
|
755
|
-
description: `Marca uma conta a pagar como paga
|
|
812
|
+
description: `Marca uma conta a pagar como paga. Dois modos:
|
|
813
|
+
(1) CRIAR nova transação de despesa (default); ou
|
|
814
|
+
(2) LINKAR a uma transação já existente no extrato (passando transaction_id) — útil quando você importou o OFX antes de cadastrar a bill.
|
|
756
815
|
|
|
757
|
-
QUANDO USAR: ao conciliar extrato e encontrar pagamento de uma conta recorrente
|
|
816
|
+
QUANDO USAR: ao conciliar extrato e encontrar pagamento de uma conta recorrente. Use fin_bills_do_mes primeiro para obter occurrence_id.
|
|
758
817
|
NÃO USAR QUANDO: quiser lançar despesa avulsa que não é conta recorrente (usar fin_criar_despesa).
|
|
759
818
|
|
|
760
819
|
CAMPOS:
|
|
761
|
-
- occurrence_id: string UUID
|
|
762
|
-
-
|
|
763
|
-
-
|
|
764
|
-
-
|
|
765
|
-
- subcategory_name:
|
|
766
|
-
- payment_date:
|
|
820
|
+
- occurrence_id: string UUID (obrigatório).
|
|
821
|
+
- transaction_id: string UUID — se passado, LINKA em vez de criar. A transação é fonte da verdade (account/amount/date vêm dela). Zero duplicação. Não combina com amount_cents/account_name/fee_cents.
|
|
822
|
+
- amount_cents: number — valor em centavos. Obrigatório quando transaction_id NÃO é passado.
|
|
823
|
+
- account_name: string — obrigatório quando transaction_id NÃO é passado.
|
|
824
|
+
- category_name / subcategory_name: opcionais (usa default da bill).
|
|
825
|
+
- payment_date: YYYY-MM-DD (default: hoje).
|
|
826
|
+
- fee_cents: number — multa/juros em centavos. Cria uma 2ª transação de despesa em "Taxas, Juros & Impostos > Multa" (ou na categoria que você especificar). Só funciona no modo CRIAR.
|
|
827
|
+
- fee_category_name / fee_subcategory_name: sobrescreve a categoria default da multa.
|
|
828
|
+
- is_catch_up: boolean — marca este pagamento como sendo de um mês PASSADO (ex: Vivo atrasada de março paga junto com abril). Exige catch_up_reference_month.
|
|
829
|
+
- catch_up_reference_month: YYYY-MM — mês que esse pagamento referencia quando is_catch_up=true. Se já existe ocorrência pendente nesse mês, ela é paga; senão, uma nova é criada.
|
|
767
830
|
|
|
768
831
|
REGRAS DE NEGÓCIO:
|
|
769
|
-
-
|
|
770
|
-
-
|
|
771
|
-
-
|
|
832
|
+
- Modo LINK (transaction_id): valida ownership, exige tipo expense, bloqueia se transação já está linkada a outra ocorrência. Retorna warning 'transaction_date_outside_occurrence_month' se tx.date não cair no mês da ocorrência.
|
|
833
|
+
- Modo CRIAR: se occurrence já foi paga, retorna erro (a menos que is_catch_up=true pra um mês diferente).
|
|
834
|
+
- Catch-up: cria/reaproveita uma ocorrência do mês catch_up_reference_month, deixando a ocorrência corrente intacta.
|
|
772
835
|
- Valores em centavos.
|
|
773
|
-
- Não suporta multa/juros no momento.
|
|
774
836
|
|
|
775
|
-
EXEMPLO:
|
|
776
|
-
{ "occurrence_id": "uuid
|
|
837
|
+
EXEMPLO — criar nova tx:
|
|
838
|
+
{ "occurrence_id": "uuid", "amount_cents": 35000, "account_name": "Itaú", "payment_date": "2026-04-01" }
|
|
839
|
+
|
|
840
|
+
EXEMPLO — linkar a tx já importada do OFX:
|
|
841
|
+
{ "occurrence_id": "uuid", "transaction_id": "uuid-da-tx-do-extrato" }
|
|
842
|
+
|
|
843
|
+
EXEMPLO — pagar com multa:
|
|
844
|
+
{ "occurrence_id": "uuid", "amount_cents": 10000, "account_name": "C6", "fee_cents": 500 }
|
|
845
|
+
|
|
846
|
+
EXEMPLO — catch-up (pagou março junto com abril):
|
|
847
|
+
{ "occurrence_id": "uuid-de-abril-qualquer", "amount_cents": 8000, "account_name": "C6", "is_catch_up": true, "catch_up_reference_month": "2026-03" }`,
|
|
777
848
|
inputSchema: {
|
|
778
849
|
type: "object",
|
|
779
850
|
properties: {
|
|
780
851
|
occurrence_id: { type: "string", description: "UUID da ocorrência (de fin_bills_do_mes)" },
|
|
781
|
-
|
|
782
|
-
|
|
852
|
+
transaction_id: { type: "string", description: "UUID de uma transação já existente pra LINKAR em vez de criar nova." },
|
|
853
|
+
amount_cents: { type: "number", description: "Valor pago em centavos (obrigatório sem transaction_id)" },
|
|
854
|
+
account_name: { type: "string", description: "Nome da conta (obrigatório sem transaction_id)" },
|
|
783
855
|
category_name: { type: "string", description: "Categoria (opcional, usa default da bill)" },
|
|
784
856
|
subcategory_name: { type: "string", description: "Subcategoria (opcional)" },
|
|
785
857
|
payment_date: { type: "string", description: "YYYY-MM-DD (default: hoje)" },
|
|
858
|
+
fee_cents: { type: "number", description: "Multa/juros em centavos. Cria 2ª transação em 'Taxas, Juros & Impostos > Multa'. Só no modo CRIAR." },
|
|
859
|
+
fee_category_name: { type: "string", description: "Sobrescreve categoria default da multa." },
|
|
860
|
+
fee_subcategory_name: { type: "string", description: "Sobrescreve subcategoria default da multa." },
|
|
861
|
+
is_catch_up: { type: "boolean", description: "True quando pagando ref. a um mês passado (precisa catch_up_reference_month)." },
|
|
862
|
+
catch_up_reference_month: { type: "string", description: "YYYY-MM — mês referência quando is_catch_up=true." },
|
|
786
863
|
},
|
|
787
|
-
required: ["occurrence_id"
|
|
864
|
+
required: ["occurrence_id"],
|
|
788
865
|
},
|
|
789
866
|
},
|
|
790
867
|
{
|
|
@@ -802,14 +879,21 @@ CAMPOS:
|
|
|
802
879
|
- account_name: string — conta default de pagamento (match parcial).
|
|
803
880
|
- category_name: string — categoria default.
|
|
804
881
|
- subcategory_name: string — subcategoria default.
|
|
882
|
+
- notes: string — contexto livre (ex: "reajusta em janeiro", "plano expira dez/2026").
|
|
883
|
+
- tags: string[] — tags pra cortes ortogonais.
|
|
884
|
+
- review_after: YYYY-MM-DD — lembrete pra revisar essa bill depois dessa data.
|
|
885
|
+
- end_date: YYYY-MM-DD — último mês (inclusive) que gera ocorrência (ex: IPTU 10x até out/2026).
|
|
886
|
+
- max_occurrences: number — alternativa a end_date: para depois de N ocorrências geradas.
|
|
805
887
|
|
|
806
888
|
REGRAS DE NEGÓCIO:
|
|
807
889
|
- amount_type 'fixed' = valor fixo todo mês (ex: condomínio R$1.383).
|
|
808
890
|
- amount_type 'variable' = valor muda (ex: Light). Definido no momento do pagamento.
|
|
891
|
+
- POST de bill já cria a ocorrência do mês atual e retorna em current_month_occurrence.
|
|
809
892
|
- Valores em centavos.
|
|
810
893
|
|
|
811
894
|
EXEMPLO:
|
|
812
|
-
{ "name": "Light", "due_day": 1, "amount_type": "variable", "category_name": "Moradia", "account_name": "Itaú" }
|
|
895
|
+
{ "name": "Light", "due_day": 1, "amount_type": "variable", "category_name": "Moradia", "account_name": "Itaú" }
|
|
896
|
+
{ "name": "IPTU", "due_day": 10, "amount_type": "fixed", "default_amount_cents": 38000, "end_date": "2026-10-10", "notes": "10x jan-out/2026" }`,
|
|
813
897
|
inputSchema: {
|
|
814
898
|
type: "object",
|
|
815
899
|
properties: {
|
|
@@ -820,6 +904,11 @@ EXEMPLO:
|
|
|
820
904
|
account_name: { type: "string", description: "Conta default de pagamento" },
|
|
821
905
|
category_name: { type: "string", description: "Categoria default" },
|
|
822
906
|
subcategory_name: { type: "string", description: "Subcategoria default" },
|
|
907
|
+
notes: { type: "string", description: "Contexto livre (max 2000 chars)." },
|
|
908
|
+
tags: { type: "array", items: { type: "string" }, description: "Tags livres (max 20)." },
|
|
909
|
+
review_after: { type: "string", description: "YYYY-MM-DD — lembrete pra revisar a bill." },
|
|
910
|
+
end_date: { type: "string", description: "YYYY-MM-DD — último mês que gera ocorrência." },
|
|
911
|
+
max_occurrences: { type: "number", description: "Para depois de N ocorrências geradas." },
|
|
823
912
|
},
|
|
824
913
|
required: ["name", "due_day"],
|
|
825
914
|
},
|
|
@@ -832,18 +921,14 @@ QUANDO USAR: mudar configurações de uma conta existente ou desativar.
|
|
|
832
921
|
|
|
833
922
|
CAMPOS:
|
|
834
923
|
- bill_id: string UUID — ID da bill (obrigatório, obter via fin_listar_bills).
|
|
835
|
-
- name
|
|
836
|
-
-
|
|
837
|
-
-
|
|
838
|
-
- default_amount_cents: number — novo valor padrão em centavos.
|
|
839
|
-
- account_name: string — nova conta default.
|
|
840
|
-
- category_name: string — nova categoria default.
|
|
841
|
-
- subcategory_name: string — nova subcategoria default.
|
|
842
|
-
- is_active: boolean — false para desativar (soft delete).
|
|
924
|
+
- name / due_day / amount_type / default_amount_cents / account_name / category_name / subcategory_name — editáveis.
|
|
925
|
+
- is_active: boolean — false para soft-delete (preserva histórico).
|
|
926
|
+
- notes / tags / review_after / end_date / max_occurrences — editáveis (null pra limpar).
|
|
843
927
|
|
|
844
928
|
REGRAS DE NEGÓCIO:
|
|
845
929
|
- Campos omitidos não são alterados.
|
|
846
930
|
- is_active: false desativa a bill (não gera novas ocorrências, mas mantém histórico).
|
|
931
|
+
- Pra HARD-delete (apagar de verdade) a bill, use fin_deletar_bill — só funciona se nenhuma ocorrência foi paga ainda.
|
|
847
932
|
- Valores em centavos.`,
|
|
848
933
|
inputSchema: {
|
|
849
934
|
type: "object",
|
|
@@ -857,6 +942,11 @@ REGRAS DE NEGÓCIO:
|
|
|
857
942
|
category_name: { type: "string", description: "Nova categoria default" },
|
|
858
943
|
subcategory_name: { type: "string", description: "Nova subcategoria default" },
|
|
859
944
|
is_active: { type: "boolean", description: "false para desativar" },
|
|
945
|
+
notes: { type: "string", description: "Contexto livre (null pra limpar)." },
|
|
946
|
+
tags: { type: "array", items: { type: "string" }, description: "Tags livres (null pra limpar)." },
|
|
947
|
+
review_after: { type: "string", description: "YYYY-MM-DD (null pra limpar)." },
|
|
948
|
+
end_date: { type: "string", description: "YYYY-MM-DD (null pra limpar)." },
|
|
949
|
+
max_occurrences: { type: "number", description: "Máximo de ocorrências (null pra limpar)." },
|
|
860
950
|
},
|
|
861
951
|
required: ["bill_id"],
|
|
862
952
|
},
|
|
@@ -872,7 +962,8 @@ CAMPOS:
|
|
|
872
962
|
- name: string — nome da conta (obrigatório, ex: "Nubank", "Inter", "Carteira").
|
|
873
963
|
- institution: string — nome da instituição financeira.
|
|
874
964
|
- type: string — 'cash' (corrente/carteira/poupança) ou 'credit' (cartão de crédito) (obrigatório).
|
|
875
|
-
-
|
|
965
|
+
- currency: string — 'BRL' ou 'USD' (default: BRL). Apenas contas cash podem ser USD. Use USD para carteira em dólar, Wise, conta americana, etc. Cartão de crédito DEVE ser BRL.
|
|
966
|
+
- initial_balance_cents: number — saldo inicial em centavos **da moeda da conta** (default: 0). Para conta USD, é em centavos de dólar (ex: $370 = 37000). Para cartão credit, é o valor de uma fatura preexistente (use com initial_invoice_date).
|
|
876
967
|
- initial_invoice_date: string YYYY-MM-DD — data da fatura inicial (cutoff histórico). OMITIR é o comportamento recomendado para cartões novos — significa "sem cutoff", ou seja, transações com qualquer tx_date (inclusive anteriores à criação) contam no total da fatura.
|
|
877
968
|
- initial_invoice_amount_cents: number — alias de initial_balance_cents quando se refere a fatura inicial de cartão. Use junto com initial_invoice_date.
|
|
878
969
|
- closing_day: number — dia de fechamento da fatura, 1-28 (obrigatório para type 'credit').
|
|
@@ -882,21 +973,27 @@ CAMPOS:
|
|
|
882
973
|
REGRAS DE NEGÓCIO:
|
|
883
974
|
- Cartão de crédito (type 'credit') EXIGE closing_day e due_day.
|
|
884
975
|
- closing_day e due_day devem estar entre 1 e 28.
|
|
885
|
-
-
|
|
886
|
-
-
|
|
976
|
+
- **currency: 'USD' só é permitido para cash.** Tentar criar credit + USD retorna erro de validação.
|
|
977
|
+
- Valores em centavos da moeda da conta (cents de BRL ou cents de USD, conforme currency).
|
|
978
|
+
- **Para cartão de crédito**: por padrão (quando initial_invoice_date é omitido), o cartão é criado SEM cutoff histórico. Transações com qualquer tx_date contam no total da fatura.
|
|
887
979
|
|
|
888
|
-
EXEMPLO — cartão novo (sem fatura preexistente):
|
|
980
|
+
EXEMPLO — cartão novo BRL (sem fatura preexistente):
|
|
889
981
|
{ "name": "Nubank", "type": "credit", "closing_day": 19, "due_day": 26, "credit_limit_cents": 500000 }
|
|
890
982
|
|
|
891
983
|
EXEMPLO — cartão migrado com fatura já aberta:
|
|
892
|
-
{ "name": "Itaú", "type": "credit", "closing_day": 1, "due_day": 9, "initial_invoice_date": "2026-03-15", "initial_invoice_amount_cents": 350000 }
|
|
984
|
+
{ "name": "Itaú", "type": "credit", "closing_day": 1, "due_day": 9, "initial_invoice_date": "2026-03-15", "initial_invoice_amount_cents": 350000 }
|
|
985
|
+
|
|
986
|
+
EXEMPLO — conta USD (Wise, carteira em dólar):
|
|
987
|
+
{ "name": "Wise USD", "institution": "Wise", "type": "cash", "currency": "USD", "initial_balance_cents": 20000 }
|
|
988
|
+
// cria conta USD com saldo $200`,
|
|
893
989
|
inputSchema: {
|
|
894
990
|
type: "object",
|
|
895
991
|
properties: {
|
|
896
992
|
name: { type: "string", description: "Nome da conta (ex: Nubank, Inter)" },
|
|
897
993
|
institution: { type: "string", description: "Nome da instituição financeira" },
|
|
898
994
|
type: { type: "string", description: "'cash' ou 'credit'" },
|
|
899
|
-
|
|
995
|
+
currency: { type: "string", description: "'BRL' (default) ou 'USD'. USD só para cash." },
|
|
996
|
+
initial_balance_cents: { type: "number", description: "Saldo inicial em centavos da moeda da conta (default: 0)" },
|
|
900
997
|
initial_invoice_date: { type: ["string", "null"], description: "YYYY-MM-DD — data da fatura inicial. Omitir ou passar null para cartão sem cutoff histórico (recomendado)." },
|
|
901
998
|
initial_invoice_amount_cents: { type: "number", description: "Valor da fatura inicial em centavos. Use com initial_invoice_date." },
|
|
902
999
|
closing_day: { type: "number", description: "Dia de fechamento da fatura (1-28, obrigatório para credit)" },
|
|
@@ -923,14 +1020,19 @@ CAMPOS:
|
|
|
923
1020
|
- closing_day: number — novo dia de fechamento (1-28).
|
|
924
1021
|
- due_day: number — novo dia de vencimento (1-28).
|
|
925
1022
|
- credit_limit_cents: number — novo limite de crédito em centavos.
|
|
1023
|
+
- currency: string — 'BRL' ou 'USD'. SÓ FUNCIONA quando a conta não tem nenhuma transação vinculada. Se tiver, retorna 409 com transactions_count — caller deve deletar/mover as transações antes.
|
|
926
1024
|
|
|
927
1025
|
REGRAS DE NEGÓCIO:
|
|
928
1026
|
- Valores em centavos.
|
|
929
1027
|
- Campos omitidos não são alterados.
|
|
930
1028
|
- Use initial_invoice_date: null para remover o cutoff histórico de um cartão (caso transações antigas estejam aparecendo fora da fatura no app).
|
|
1029
|
+
- currency é imutável quando há transações.
|
|
931
1030
|
|
|
932
1031
|
EXEMPLO — remover cutoff de um cartão criado errado:
|
|
933
|
-
{ "account_id": "uuid-do-cartao", "initial_invoice_date": null, "initial_invoice_amount_cents": 0 }
|
|
1032
|
+
{ "account_id": "uuid-do-cartao", "initial_invoice_date": null, "initial_invoice_amount_cents": 0 }
|
|
1033
|
+
|
|
1034
|
+
EXEMPLO — corrigir moeda de uma conta recém-criada (sem transações):
|
|
1035
|
+
{ "account_id": "uuid-da-conta", "currency": "USD" }`,
|
|
934
1036
|
inputSchema: {
|
|
935
1037
|
type: "object",
|
|
936
1038
|
properties: {
|
|
@@ -944,6 +1046,41 @@ EXEMPLO — remover cutoff de um cartão criado errado:
|
|
|
944
1046
|
closing_day: { type: "number", description: "Novo dia de fechamento (1-28)" },
|
|
945
1047
|
due_day: { type: "number", description: "Novo dia de vencimento (1-28)" },
|
|
946
1048
|
credit_limit_cents: { type: "number", description: "Novo limite de crédito em centavos" },
|
|
1049
|
+
currency: { type: "string", description: "'BRL' ou 'USD'. Só funciona se a conta não tem transações." },
|
|
1050
|
+
},
|
|
1051
|
+
required: ["account_id"],
|
|
1052
|
+
},
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
name: "fin_deletar_conta",
|
|
1056
|
+
description: `Deleta uma conta bancária. Bloqueia a deleção se a conta tem transações vinculadas — não cascata.
|
|
1057
|
+
|
|
1058
|
+
QUANDO USAR:
|
|
1059
|
+
- Remover uma conta criada por engano (nome errado, moeda errada, tipo errado).
|
|
1060
|
+
- Limpar contas duplicadas antes de importar histórico.
|
|
1061
|
+
|
|
1062
|
+
NÃO USAR QUANDO:
|
|
1063
|
+
- A conta tem transações importantes. Se precisa remover uma conta em uso, delete as transações primeiro OU renomeie a conta via fin_editar_conta (soft-archive via renomear para "[ARQUIVADO] Nome").
|
|
1064
|
+
|
|
1065
|
+
CAMPOS:
|
|
1066
|
+
- account_id: string UUID — ID da conta (obrigatório).
|
|
1067
|
+
|
|
1068
|
+
REGRAS DE NEGÓCIO:
|
|
1069
|
+
- Se a conta tem qualquer transação vinculada (como account_from ou account_to), retorna erro 409 com a contagem de transações — a conta NÃO é deletada.
|
|
1070
|
+
- Sem cascata silenciosa: destruir histórico é pior que um erro claro.
|
|
1071
|
+
- Se precisar de hard-delete com histórico, delete as transações primeiro.
|
|
1072
|
+
|
|
1073
|
+
EXEMPLO — deletar conta sem transações:
|
|
1074
|
+
{ "account_id": "uuid-da-conta" }
|
|
1075
|
+
→ retorna { ok: true, deleted: true }
|
|
1076
|
+
|
|
1077
|
+
EXEMPLO — tentativa bloqueada:
|
|
1078
|
+
{ "account_id": "uuid-da-conta-com-transacoes" }
|
|
1079
|
+
→ retorna 409 { ok: false, error: "Conta X tem N transação(ões) vinculada(s)...", transactions_count: N }`,
|
|
1080
|
+
inputSchema: {
|
|
1081
|
+
type: "object",
|
|
1082
|
+
properties: {
|
|
1083
|
+
account_id: { type: "string", description: "UUID da conta" },
|
|
947
1084
|
},
|
|
948
1085
|
required: ["account_id"],
|
|
949
1086
|
},
|
|
@@ -1046,6 +1183,199 @@ REGRAS DE NEGÓCIO:
|
|
|
1046
1183
|
required: ["subcategory_id"],
|
|
1047
1184
|
},
|
|
1048
1185
|
},
|
|
1186
|
+
// ── Bugs #17/#15/#16/#18-34 — new tools ───────────────────────────
|
|
1187
|
+
{
|
|
1188
|
+
name: "fin_patrimonio",
|
|
1189
|
+
description: `Retorna patrimônio consolidado multi-moeda (cash + checking) em uma moeda de exibição.
|
|
1190
|
+
|
|
1191
|
+
QUANDO USAR: responder "quanto eu tenho hoje no total em reais?" — pergunta básica de dashboard.
|
|
1192
|
+
NÃO USAR QUANDO: quiser ver saldos nativos por conta (usar fin_saldos).
|
|
1193
|
+
|
|
1194
|
+
CAMPOS:
|
|
1195
|
+
- display_currency: 'BRL' | 'USD' — moeda em que o total é exibido (default: BRL).
|
|
1196
|
+
|
|
1197
|
+
REGRAS DE NEGÓCIO:
|
|
1198
|
+
- Usa getBalanceService (mesmo dado de fin_saldos).
|
|
1199
|
+
- Converte USD→BRL via cotação 1h-cached (AwesomeAPI / exchangerate.host).
|
|
1200
|
+
- Se a cotação está off: retorna total BRL PARCIAL + partial: true + warning 'partial_total_exchange_rate_unavailable'.
|
|
1201
|
+
- Retorno: { as_of, display_currency, exchange_rates, total_cents, partial, breakdown_by_currency: { BRL: {...}, USD: {...} }, breakdown_by_account: [{ account_id, account_name, currency, balance_cents, balance_in_display_cents }] }
|
|
1202
|
+
- ATENÇÃO: essa tool usa cotação DINÂMICA. Pra transações individuais (gastos em dólar), o caller deve informar a cotação real paga — ver fin_criar_despesa.`,
|
|
1203
|
+
inputSchema: {
|
|
1204
|
+
type: "object",
|
|
1205
|
+
properties: {
|
|
1206
|
+
display_currency: { type: "string", description: "'BRL' (default) ou 'USD'." },
|
|
1207
|
+
},
|
|
1208
|
+
},
|
|
1209
|
+
},
|
|
1210
|
+
{
|
|
1211
|
+
name: "fin_criar_estorno",
|
|
1212
|
+
description: `Cria um estorno atômico de uma despesa — versão simplificada de fin_criar_despesa com reversal_of_id.
|
|
1213
|
+
|
|
1214
|
+
QUANDO USAR: quando já sabe o UUID da transação original que quer estornar (ex: achou via fin_buscar_transacoes ou fin_fatura_transacoes). A tool herda account/category/subcategory da original automaticamente.
|
|
1215
|
+
NÃO USAR QUANDO: quiser fazer uma nova despesa sem relação com estorno (usar fin_criar_despesa).
|
|
1216
|
+
|
|
1217
|
+
CAMPOS:
|
|
1218
|
+
- original_transaction_id: string UUID (obrigatório) — transação original.
|
|
1219
|
+
- amount_cents: number (obrigatório) — valor em centavos. Pode ser parcial (ex: 7216 de uma compra de 10000).
|
|
1220
|
+
- tx_date: YYYY-MM-DD — data do estorno (default: hoje).
|
|
1221
|
+
- description: string — descrição custom (default: "Estorno: <descrição original>").
|
|
1222
|
+
|
|
1223
|
+
REGRAS DE NEGÓCIO:
|
|
1224
|
+
- A original precisa ser tipo 'expense'. Retorna 422 senão.
|
|
1225
|
+
- amount_cents não pode exceder o valor da original. Retorna 422 se exceder.
|
|
1226
|
+
- reversal_kind é derivado: 'full' se amount == original, 'partial' senão.
|
|
1227
|
+
- account/category/subcategory são HERDADOS da original — sem precisar informar.
|
|
1228
|
+
- Retorna o mesmo shape de fin_criar_despesa.
|
|
1229
|
+
|
|
1230
|
+
EXEMPLO — estorno parcial:
|
|
1231
|
+
{ "original_transaction_id": "uuid-original", "amount_cents": 7216, "description": "Devolução parcial defeito" }
|
|
1232
|
+
|
|
1233
|
+
EXEMPLO — estorno total:
|
|
1234
|
+
{ "original_transaction_id": "uuid-original", "amount_cents": 10000 }`,
|
|
1235
|
+
inputSchema: {
|
|
1236
|
+
type: "object",
|
|
1237
|
+
properties: {
|
|
1238
|
+
original_transaction_id: { type: "string", description: "UUID da transação original" },
|
|
1239
|
+
amount_cents: { type: "number", description: "Valor do estorno em centavos (pode ser parcial)" },
|
|
1240
|
+
tx_date: { type: "string", description: "YYYY-MM-DD (default: hoje)" },
|
|
1241
|
+
description: { type: "string", description: "Descrição custom (default: 'Estorno: ...')" },
|
|
1242
|
+
},
|
|
1243
|
+
required: ["original_transaction_id", "amount_cents"],
|
|
1244
|
+
},
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
name: "fin_classificar_linha_extrato",
|
|
1248
|
+
description: `Classifica uma linha de extrato bancário em uma das 5 categorias semânticas.
|
|
1249
|
+
|
|
1250
|
+
QUANDO USAR: em skills que importam OFX/CNAB/CSV e precisam decidir se cada linha é despesa, receita, transfer, pagamento de fatura, ou saque ATM. Evita reinventar heurística cliente-side.
|
|
1251
|
+
NÃO USAR QUANDO: a skill já sabe o tipo (ex: acabou de chamar fin_criar_despesa).
|
|
1252
|
+
|
|
1253
|
+
CAMPOS:
|
|
1254
|
+
- description: string (obrigatório) — descrição da linha do extrato.
|
|
1255
|
+
- amount_cents: number (obrigatório) — valor em centavos. Negativo = débito, positivo = crédito.
|
|
1256
|
+
- account_id: string UUID (obrigatório) — conta do extrato que está sendo importado.
|
|
1257
|
+
- trntype: string — hint OFX (ATM, XFER, PAYMENT, DEBIT, CREDIT). Opcional.
|
|
1258
|
+
- fitid: string — FITID OFX, pass-through no retorno pra idempotência.
|
|
1259
|
+
|
|
1260
|
+
REGRAS DE NEGÓCIO:
|
|
1261
|
+
- Retorna { type, confidence, reason, details, from_account_id, from_account_name, fitid }
|
|
1262
|
+
- type ∈ { 'expense', 'income', 'transfer', 'payment_invoice', 'atm_withdrawal' }
|
|
1263
|
+
- details:
|
|
1264
|
+
- atm_withdrawal → { suggested_cash_account_id: UUID pra conta "Dinheiro" se existir }
|
|
1265
|
+
- payment_invoice → { suggested_card_account_id: UUID do cartão se der pra adivinhar pelo nome na descrição }
|
|
1266
|
+
- transfer → { suggested_counterparty_account_id: UUID da outra conta do user se bateu pelo nome }
|
|
1267
|
+
- expense/income → {}
|
|
1268
|
+
- O caller orquestra: recebe a classificação e chama fin_criar_despesa / fin_criar_transferencia / fin_pagar_fatura conforme.
|
|
1269
|
+
- Matching de nomes de conta tem blocklist de palavras genéricas (PIX, TED, DOC, etc) pra evitar falso positivo.
|
|
1270
|
+
|
|
1271
|
+
EXEMPLO:
|
|
1272
|
+
{ "description": "SAQUE 24H BANCO X", "amount_cents": -20000, "account_id": "uuid-c6", "trntype": "ATM" }
|
|
1273
|
+
→ { type: "atm_withdrawal", confidence: "high", details: { suggested_cash_account_id: "uuid-dinheiro" } }`,
|
|
1274
|
+
inputSchema: {
|
|
1275
|
+
type: "object",
|
|
1276
|
+
properties: {
|
|
1277
|
+
description: { type: "string" },
|
|
1278
|
+
amount_cents: { type: "number", description: "Centavos (negativo = débito, positivo = crédito)" },
|
|
1279
|
+
account_id: { type: "string", description: "UUID da conta sendo importada" },
|
|
1280
|
+
trntype: { type: "string", description: "Hint OFX (ATM, XFER, PAYMENT, DEBIT, CREDIT)" },
|
|
1281
|
+
fitid: { type: "string", description: "FITID OFX, pass-through no retorno" },
|
|
1282
|
+
},
|
|
1283
|
+
required: ["description", "amount_cents", "account_id"],
|
|
1284
|
+
},
|
|
1285
|
+
},
|
|
1286
|
+
{
|
|
1287
|
+
name: "fin_criar_transacoes_batch",
|
|
1288
|
+
description: `Cria múltiplas transações (despesa/receita/transferência) em uma única chamada. Max 100 por batch.
|
|
1289
|
+
|
|
1290
|
+
QUANDO USAR:
|
|
1291
|
+
- Conciliação de extrato com várias transações que não passaram pelo parser automático.
|
|
1292
|
+
- Lançamento em lote de parcelas avulsas (ex: várias compras parceladas antigas).
|
|
1293
|
+
- Qualquer cenário que geraria N chamadas individuais de criar_despesa/criar_receita/criar_transferencia.
|
|
1294
|
+
NÃO USAR QUANDO: uma única transação atômica com rollback é necessária (essa tool é "partial success by design").
|
|
1295
|
+
|
|
1296
|
+
CAMPOS:
|
|
1297
|
+
- transactions: array — cada item é um objeto com type + campos do tipo correspondente. Discriminated union:
|
|
1298
|
+
- { type: "expense", amount_cents, description, account_name?, category_name?, subcategory_name?, tx_date?, essential?, invoice_cycle_end?, tags? }
|
|
1299
|
+
- { type: "income", amount_cents, description, account_name?, category_name?, subcategory_name?, tx_date?, tags? }
|
|
1300
|
+
- { type: "transfer", amount_cents, description, account_from, account_to, tx_date? }
|
|
1301
|
+
|
|
1302
|
+
REGRAS DE NEGÓCIO:
|
|
1303
|
+
- Loop sequencial (não-transacional). Falha no meio NÃO reverte as anteriores.
|
|
1304
|
+
- Resposta: { ok: true, total, created: [{ index, transaction_id, type }], failed: [{ index, error }] }.
|
|
1305
|
+
- Caller decide o que fazer com 'failed' (retry, logar, abortar).
|
|
1306
|
+
- Max 100 rows por chamada pra limitar memória de request.
|
|
1307
|
+
|
|
1308
|
+
EXEMPLO:
|
|
1309
|
+
{
|
|
1310
|
+
"transactions": [
|
|
1311
|
+
{ "type": "expense", "amount_cents": 5000, "description": "Almoço", "account_name": "C6" },
|
|
1312
|
+
{ "type": "income", "amount_cents": 500000, "description": "Salário", "account_name": "Itaú" },
|
|
1313
|
+
{ "type": "transfer", "amount_cents": 10000, "description": "pra poupança", "account_from": "C6", "account_to": "Poupança" }
|
|
1314
|
+
]
|
|
1315
|
+
}`,
|
|
1316
|
+
inputSchema: {
|
|
1317
|
+
type: "object",
|
|
1318
|
+
properties: {
|
|
1319
|
+
transactions: {
|
|
1320
|
+
type: "array",
|
|
1321
|
+
description: "Lista de transações a criar (max 100)",
|
|
1322
|
+
items: { type: "object" },
|
|
1323
|
+
},
|
|
1324
|
+
},
|
|
1325
|
+
required: ["transactions"],
|
|
1326
|
+
},
|
|
1327
|
+
},
|
|
1328
|
+
{
|
|
1329
|
+
name: "fin_deletar_bill",
|
|
1330
|
+
description: `Hard-delete de uma bill recorrente. Só funciona se NENHUMA ocorrência foi paga.
|
|
1331
|
+
|
|
1332
|
+
QUANDO USAR: remover bill criada por engano (nome/categoria errada) antes de qualquer pagamento.
|
|
1333
|
+
NÃO USAR QUANDO: a bill já tem ocorrências pagas — use fin_editar_bill com is_active: false (soft-delete, preserva histórico).
|
|
1334
|
+
|
|
1335
|
+
CAMPOS:
|
|
1336
|
+
- bill_id: string UUID (obrigatório).
|
|
1337
|
+
|
|
1338
|
+
REGRAS DE NEGÓCIO:
|
|
1339
|
+
- Se a bill tem ≥1 ocorrência com transaction_id != null, retorna 409 com soft_delete_hint.
|
|
1340
|
+
- Ocorrências NÃO pagas são deletadas em cascata (FK ON DELETE CASCADE).`,
|
|
1341
|
+
inputSchema: {
|
|
1342
|
+
type: "object",
|
|
1343
|
+
properties: {
|
|
1344
|
+
bill_id: { type: "string", description: "UUID da bill" },
|
|
1345
|
+
},
|
|
1346
|
+
required: ["bill_id"],
|
|
1347
|
+
},
|
|
1348
|
+
},
|
|
1349
|
+
{
|
|
1350
|
+
name: "fin_editar_occurrence",
|
|
1351
|
+
description: `Edita uma ocorrência específica de bill (amount_cents, due_date, notes) sem alterar o template mãe.
|
|
1352
|
+
|
|
1353
|
+
QUANDO USAR:
|
|
1354
|
+
- Bill 'fixed' teve valor diferente em UM mês (multa, reajuste retroativo).
|
|
1355
|
+
- Data de vencimento mudou num mês específico (feriado, dia não-útil).
|
|
1356
|
+
- Anotar contexto local (ex: "pago com desconto pontual").
|
|
1357
|
+
NÃO USAR QUANDO: quiser mudar o default permanente da bill (usar fin_editar_bill).
|
|
1358
|
+
|
|
1359
|
+
CAMPOS:
|
|
1360
|
+
- occurrence_id: string UUID (obrigatório).
|
|
1361
|
+
- amount_cents: number — novo valor em centavos.
|
|
1362
|
+
- due_date: string YYYY-MM-DD — novo dia de vencimento.
|
|
1363
|
+
- notes: string | null — anotação livre (null pra limpar).
|
|
1364
|
+
|
|
1365
|
+
REGRAS DE NEGÓCIO:
|
|
1366
|
+
- Se a ocorrência já foi paga (tem transaction_id) e você tenta editar amount_cents: retorna 409 (a transação é a fonte da verdade; use fin_editar_transacao).
|
|
1367
|
+
- Outros campos podem ser editados mesmo em ocorrência paga.`,
|
|
1368
|
+
inputSchema: {
|
|
1369
|
+
type: "object",
|
|
1370
|
+
properties: {
|
|
1371
|
+
occurrence_id: { type: "string", description: "UUID da ocorrência" },
|
|
1372
|
+
amount_cents: { type: "number", description: "Novo valor em centavos" },
|
|
1373
|
+
due_date: { type: "string", description: "YYYY-MM-DD" },
|
|
1374
|
+
notes: { type: ["string", "null"], description: "Anotação livre (null pra limpar)" },
|
|
1375
|
+
},
|
|
1376
|
+
required: ["occurrence_id"],
|
|
1377
|
+
},
|
|
1378
|
+
},
|
|
1049
1379
|
];
|
|
1050
1380
|
|
|
1051
1381
|
// ── Tool handlers ───────────────────────────────────────────────────
|
|
@@ -1159,7 +1489,10 @@ async function handleTool(name, args) {
|
|
|
1159
1489
|
return ok(await api("GET", `/api/genius/bills`));
|
|
1160
1490
|
}
|
|
1161
1491
|
case "fin_bills_do_mes": {
|
|
1162
|
-
const
|
|
1492
|
+
const params = new URLSearchParams();
|
|
1493
|
+
if (args.month) params.set("month", args.month);
|
|
1494
|
+
if (args.status) params.set("status", args.status);
|
|
1495
|
+
const qs = params.toString() ? `?${params}` : "";
|
|
1163
1496
|
return ok(await api("GET", `/api/genius/bills/occurrences${qs}`));
|
|
1164
1497
|
}
|
|
1165
1498
|
case "fin_pagar_bill": {
|
|
@@ -1200,6 +1533,9 @@ async function handleTool(name, args) {
|
|
|
1200
1533
|
}
|
|
1201
1534
|
return ok(await api("PATCH", `/api/genius/accounts/${account_id}`, body));
|
|
1202
1535
|
}
|
|
1536
|
+
case "fin_deletar_conta": {
|
|
1537
|
+
return ok(await api("DELETE", `/api/genius/accounts/${args.account_id}`));
|
|
1538
|
+
}
|
|
1203
1539
|
case "fin_listar_categorias": {
|
|
1204
1540
|
return ok(await api("GET", `/api/genius/categories`));
|
|
1205
1541
|
}
|
|
@@ -1217,6 +1553,27 @@ async function handleTool(name, args) {
|
|
|
1217
1553
|
const { subcategory_id, ...body } = args;
|
|
1218
1554
|
return ok(await api("PATCH", `/api/genius/subcategories/${subcategory_id}`, body));
|
|
1219
1555
|
}
|
|
1556
|
+
// ── Bugs #17/#15/#16/#18-34 — new tool handlers ───────────────
|
|
1557
|
+
case "fin_patrimonio": {
|
|
1558
|
+
const qs = args.display_currency ? `?display_currency=${args.display_currency}` : "";
|
|
1559
|
+
return ok(await api("GET", `/api/genius/patrimony${qs}`));
|
|
1560
|
+
}
|
|
1561
|
+
case "fin_criar_estorno": {
|
|
1562
|
+
return ok(await api("POST", `/api/genius/reversals`, args));
|
|
1563
|
+
}
|
|
1564
|
+
case "fin_classificar_linha_extrato": {
|
|
1565
|
+
return ok(await api("POST", `/api/genius/classify-statement-line`, args));
|
|
1566
|
+
}
|
|
1567
|
+
case "fin_criar_transacoes_batch": {
|
|
1568
|
+
return ok(await api("POST", `/api/genius/transactions/batch`, args));
|
|
1569
|
+
}
|
|
1570
|
+
case "fin_deletar_bill": {
|
|
1571
|
+
return ok(await api("DELETE", `/api/genius/bills/${args.bill_id}`));
|
|
1572
|
+
}
|
|
1573
|
+
case "fin_editar_occurrence": {
|
|
1574
|
+
const { occurrence_id, ...body } = args;
|
|
1575
|
+
return ok(await api("PATCH", `/api/genius/bills/occurrences/${occurrence_id}`, body));
|
|
1576
|
+
}
|
|
1220
1577
|
default:
|
|
1221
1578
|
return err(`Tool desconhecida: ${name}`);
|
|
1222
1579
|
}
|
|
@@ -1225,7 +1582,7 @@ async function handleTool(name, args) {
|
|
|
1225
1582
|
// ── Server ──────────────────────────────────────────────────────────
|
|
1226
1583
|
|
|
1227
1584
|
const server = new Server(
|
|
1228
|
-
{ name: "fin-app", version: "2.3.
|
|
1585
|
+
{ name: "fin-app", version: "2.3.3" },
|
|
1229
1586
|
{ capabilities: { tools: {}, resources: {} } }
|
|
1230
1587
|
);
|
|
1231
1588
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fin-app-mcp",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.4",
|
|
4
4
|
"description": "MCP server para o FIN App — finanças pessoais. Expõe tools para agents LLM operarem contas, despesas, faturas de cartão, bills recorrentes e mais.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.mjs",
|