Caderninho / guias
Assistentes e ferramentasFerramentas MCPAnálises e assinaturas

get_spending_comparison

Comparar gastos com período anterior de igual duração, mesmos dias do mês anterior ou intervalo explícito. Já inclui grupos e totais dos dois períodos.

Análises e assinaturas · Analisar · Consulta / prévia

Efeito da chamada

Consulta ou simula sem gravar alterações financeiras nem iniciar uma importação.

Parâmetros

CampoObrigatórioTipoUso
personIdNãotextoTitular declarado. Obtenha seu ID em caderninho_status.
spaceIdNãotextoEspaço da instalação. Consulte get_spaces; o espaço inicial é personal. Padrão: "personal".
accountIdNãotextoID de conta devolvido por get_accounts.
cardNumberNãotextoQuatro últimos dígitos do cartão recebidos na identificação da origem.
categoryIdNãotextoID de categoria devolvido por get_categories no mesmo espaço.
currencyNão"BRL" / "USD" / "EUR" / "GBP" / "ARS" / "AUD" / "BHD" / "CAD" / "CHF" / "CLP" / "JPY" / "KWD"Moeda da operação. Valores de moedas diferentes permanecem separados.
directionNão"DEBIT" / "CREDIT"Direção DEBIT ou CREDIT. Ela não determina, sozinha, despesa ou receita.
fromSimtextoPrimeiro dia incluído na seleção, em AAAA-MM-DD.
include_ignoredNãobooleanoInclui lançamentos marcados como ignorados na seleção. Padrão: false.
statusNão"PENDING" / "POSTED"Estado do registro ou filtro. Use somente as opções aceitas por esta ferramenta.
tagIdNãotextoID de etiqueta devolvido por get_tags no mesmo espaço.
textNãotextoTexto literal de busca ou condição. Confira as regras de comparação da ferramenta.
toSimtextoÚltimo dia incluído na seleção, em AAAA-MM-DD.
uncategorizedNãobooleanoSomente lançamentos sem categoria efetiva.
comparisonNão"previous_period" / "previous_month" / "explicit"Critério do período anterior. explicit usa previousFrom e previousTo. Padrão: "previous_period".
previousFromNãotextoPrimeiro dia do período anterior explícito, em AAAA-MM-DD.
previousToNãotextoÚltimo dia do período anterior explícito, em AAAA-MM-DD.

Filtros compostos e limites estão no schema completo. Campos não listados são recusados.

Exemplo de chamada

Substitua os IDs fictícios pelos da sua instalação, obtidos nas consultas indicadas nos parâmetros.


{
  "name": "get_spending_comparison",
  "arguments": {
    "from": "2026-10-01",
    "to": "2026-10-31"
  }
}

Interpretar o resultado

Preserve moeda, valores desconhecidos, cobertura e datas de referência informados na resposta. Uma leitura sem registros não comprova ausência de movimentos no banco. Para totais, use agregações de toda a seleção.

O JSON Schema de saída está em Contrato completo.

Contrato completo

Ver JSON Schema de entrada

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "personId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "spaceId": {
      "default": "personal",
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "accountId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "cardNumber": {
      "type": "string",
      "pattern": "^\\d{4}$"
    },
    "categoryId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "currency": {
      "type": "string",
      "enum": [
        "BRL",
        "USD",
        "EUR",
        "GBP",
        "ARS",
        "AUD",
        "BHD",
        "CAD",
        "CHF",
        "CLP",
        "JPY",
        "KWD"
      ]
    },
    "direction": {
      "type": "string",
      "enum": [
        "DEBIT",
        "CREDIT"
      ]
    },
    "from": {
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "include_ignored": {
      "default": false,
      "type": "boolean"
    },
    "status": {
      "type": "string",
      "enum": [
        "PENDING",
        "POSTED"
      ]
    },
    "tagId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "text": {
      "type": "string",
      "maxLength": 240
    },
    "to": {
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "uncategorized": {
      "description": "Somente lançamentos sem categoria efetiva.",
      "type": "boolean"
    },
    "comparison": {
      "default": "previous_period",
      "type": "string",
      "enum": [
        "previous_period",
        "previous_month",
        "explicit"
      ]
    },
    "previousFrom": {
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "previousTo": {
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    }
  },
  "required": [
    "from",
    "to"
  ],
  "additionalProperties": false
}
Ver JSON Schema de saída

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "coverage": {
      "type": "object",
      "properties": {
        "connectionIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "kind": {
          "type": "string",
          "enum": [
            "imported",
            "local_only",
            "empty"
          ]
        },
        "oldestLastSuccessAt": {
          "type": [
            "string",
            "null"
          ]
        },
        "partial": {
          "type": "boolean"
        }
      },
      "required": [
        "connectionIds",
        "kind",
        "oldestLastSuccessAt",
        "partial"
      ],
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "properties": {
        "comparison": {
          "type": "string",
          "enum": [
            "previous_period",
            "previous_month",
            "explicit"
          ]
        },
        "current": {
          "type": "object",
          "properties": {
            "classification": {
              "type": "string"
            },
            "from": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            },
            "groups": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "group": {
                    "type": "string"
                  },
                  "categoryId": {
                    "type": "string"
                  },
                  "categoryName": {
                    "type": "string"
                  },
                  "formattedAmount": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "scale": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "amountMinor",
                  "currency",
                  "group",
                  "formattedAmount",
                  "label",
                  "scale"
                ],
                "additionalProperties": false
              }
            },
            "partial": {
              "type": "boolean"
            },
            "referenceDay": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            },
            "to": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            },
            "totals": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "cashFlowMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "count": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "currency": {
                    "type": "string"
                  },
                  "expenseMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "incomeMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "knownCashFlowMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "knownExpenseMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "knownIncomeMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "unclassifiedCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "unknownAmountCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "knownUnclassifiedMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "unclassifiedMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "unclassifiedUnknownAmountCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "cashFlowMinor",
                  "count",
                  "currency",
                  "expenseMinor",
                  "incomeMinor",
                  "knownCashFlowMinor",
                  "knownExpenseMinor",
                  "knownIncomeMinor",
                  "unclassifiedCount",
                  "unknownAmountCount",
                  "knownUnclassifiedMinor",
                  "unclassifiedMinor",
                  "unclassifiedUnknownAmountCount"
                ],
                "additionalProperties": false
              }
            },
            "dateBasis": {
              "type": "string",
              "const": "transaction"
            },
            "eligibility": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string",
                  "const": "POSTED"
                },
                "throughDay": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                }
              },
              "required": [
                "status",
                "throughDay"
              ],
              "additionalProperties": false
            },
            "measure": {
              "type": "string",
              "const": "classified_expense"
            },
            "selection": {
              "type": "object",
              "properties": {
                "accountId": {
                  "type": "string"
                },
                "cardNumber": {
                  "type": "string"
                },
                "categoryId": {
                  "type": "string"
                },
                "currency": {
                  "type": "string"
                },
                "direction": {
                  "type": "string",
                  "enum": [
                    "DEBIT",
                    "CREDIT"
                  ]
                },
                "from": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                },
                "include_ignored": {
                  "type": "boolean"
                },
                "personId": {
                  "type": "string"
                },
                "spaceId": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "PENDING",
                    "POSTED"
                  ]
                },
                "tagId": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                },
                "to": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                }
              },
              "required": [
                "from",
                "include_ignored",
                "spaceId",
                "to"
              ],
              "additionalProperties": {}
            },
            "unit": {
              "type": "string",
              "const": "minor"
            }
          },
          "required": [
            "classification",
            "from",
            "groups",
            "partial",
            "referenceDay",
            "to",
            "totals",
            "dateBasis",
            "eligibility",
            "measure",
            "selection",
            "unit"
          ],
          "additionalProperties": {}
        },
        "previous": {
          "type": "object",
          "properties": {
            "classification": {
              "type": "string"
            },
            "from": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            },
            "groups": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "group": {
                    "type": "string"
                  },
                  "categoryId": {
                    "type": "string"
                  },
                  "categoryName": {
                    "type": "string"
                  },
                  "formattedAmount": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "scale": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "amountMinor",
                  "currency",
                  "group",
                  "formattedAmount",
                  "label",
                  "scale"
                ],
                "additionalProperties": false
              }
            },
            "partial": {
              "type": "boolean"
            },
            "referenceDay": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            },
            "to": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            },
            "totals": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "cashFlowMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "count": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "currency": {
                    "type": "string"
                  },
                  "expenseMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "incomeMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "knownCashFlowMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "knownExpenseMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "knownIncomeMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "unclassifiedCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "unknownAmountCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "knownUnclassifiedMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "unclassifiedMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "unclassifiedUnknownAmountCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "cashFlowMinor",
                  "count",
                  "currency",
                  "expenseMinor",
                  "incomeMinor",
                  "knownCashFlowMinor",
                  "knownExpenseMinor",
                  "knownIncomeMinor",
                  "unclassifiedCount",
                  "unknownAmountCount",
                  "knownUnclassifiedMinor",
                  "unclassifiedMinor",
                  "unclassifiedUnknownAmountCount"
                ],
                "additionalProperties": false
              }
            },
            "dateBasis": {
              "type": "string",
              "const": "transaction"
            },
            "eligibility": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string",
                  "const": "POSTED"
                },
                "throughDay": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                }
              },
              "required": [
                "status",
                "throughDay"
              ],
              "additionalProperties": false
            },
            "measure": {
              "type": "string",
              "const": "classified_expense"
            },
            "selection": {
              "type": "object",
              "properties": {
                "accountId": {
                  "type": "string"
                },
                "cardNumber": {
                  "type": "string"
                },
                "categoryId": {
                  "type": "string"
                },
                "currency": {
                  "type": "string"
                },
                "direction": {
                  "type": "string",
                  "enum": [
                    "DEBIT",
                    "CREDIT"
                  ]
                },
                "from": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                },
                "include_ignored": {
                  "type": "boolean"
                },
                "personId": {
                  "type": "string"
                },
                "spaceId": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "PENDING",
                    "POSTED"
                  ]
                },
                "tagId": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                },
                "to": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                }
              },
              "required": [
                "from",
                "include_ignored",
                "spaceId",
                "to"
              ],
              "additionalProperties": {}
            },
            "unit": {
              "type": "string",
              "const": "minor"
            }
          },
          "required": [
            "classification",
            "from",
            "groups",
            "partial",
            "referenceDay",
            "to",
            "totals",
            "dateBasis",
            "eligibility",
            "measure",
            "selection",
            "unit"
          ],
          "additionalProperties": {}
        }
      },
      "required": [
        "comparison",
        "current",
        "previous"
      ],
      "additionalProperties": false
    },
    "oldestLastSuccessAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "partial": {
      "type": "boolean"
    },
    "revision": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "scope": {
      "type": "object",
      "properties": {
        "personId": {
          "type": "string"
        },
        "spaceId": {
          "type": "string"
        }
      },
      "required": [
        "spaceId"
      ],
      "additionalProperties": false
    },
    "view": {
      "type": "string",
      "const": "effective"
    }
  },
  "required": [
    "coverage",
    "data",
    "oldestLastSuccessAt",
    "partial",
    "revision",
    "scope",
    "view"
  ],
  "additionalProperties": {}
}

Voltar para Análises e assinaturas · Confirmações e contratos

Nesta página