参考MCP 工具ledger

Tool Reference

ledger

当 agent 需要持久 operational context 时,使用受治理的 ledger 和 reminder 界面。

记录前先审查

先检查当前 summary;ledger record 属于 financial data,重复条目比缺失条目更难判断。

ledger({ action: "summary", months: 1 })

公开 MCP 工具

ledger

用途

通过 Ledger dispatcher 管理受治理的 financial transaction 和 external-service renewal reminder,并提供结构化 summary 与 audit boundary。

适用场景

  • 记录包含 amount、currency、date 和 merchant context 的 expense 或其他支持的 transaction。
  • 按 date、category、currency 或 project filter 列出、汇总或查看已授权的 Ledger record。
  • 创建或管理 subscription renewal reminder,并可选择将其 review cycle 连接到 TODO。

不适用场景

  • 不要对 financial record 使用 generic remember;ledger 会保留 financial data contract。
  • 不要推断跨 currency total;聚合不安全时,summary 会将 currencies 分开。
  • 没有所需的准确 ID/version 和 user authorization 时,不要 update 或 delete record。
  • REST API 接受的 field set 比 public MCP tool 更宽;scope、bucket、team 和 provenance filter 见 /docs/api/memory。

所需权限范围

  • Read actions 需要 memory:read;public chat surface 中的 transaction 和 subscription mutations 需要 memory:write。
  • 认证的 owner/team/scope boundary 管辖每一项 Ledger record 和 reminder operation。

参数列表

参数名类型描述
actionadd_expense | list | summary | overview | update_transaction · 必填由 caller 选择的 Ledger operation。只接受这五个 literal values。
item / amount / transaction_type / currencystring / number核心 transaction fields;financial write 必须提供 amount 和 currency。
transaction_date / category / merchant / payment_method / notestring可选的 transaction classification、date 和 note fields。
query / date_from / date_to / min_amount / max_amountstring / numberList 和 summary filters。
transaction_id / expected_version / patchstring / integer / object准确的 update target、optimistic concurrency version 和允许的 update fields。
owner_timezone / project_idstring日期解释和已授权的 project/team boundary。
limit / offset / monthsinteger / boolean · 默认值: 20 / 0 / 6 / falsePagination、summary horizon 和 structured-output controls。

返回模式

Structured output 包含请求的 transaction、summary groups 或 overview,以及面向用户的 text summary。Widget caller 可能收到 refresh metadata;raw secrets 永远不属于 response contract。

使用示例

记录 expense
ledger({
  action: "add_expense",
  item: "Domain renewal",
  amount: 18.00,
  currency: "USD",
  transaction_date: "2026-08-21",
  category: "software"
})
审查月度 summary
ledger({ action: "summary", months: 1 })

错误信息

  • Authorization failure:token 在读取时缺少 memory:read,或在 mutation 时缺少 memory:write。
  • Validation failure:所需 transaction fields、date formats、currency 或 action values 无效。
  • Concurrency failure:update 使用了过时的 expected_version,或找不到准确的 transaction。
  • Aggregation boundary:不同 currencies 的 records 会分开报告,不会生成虚假的 combined total。
  • remember — 只用于 record 周围的非 financial durable context。
  • todos — 一般 follow-up task 使用 TODO;ledger 可以选择加入 review reminder。
  • forget — 通过受治理的 lifecycle 移除经过审查的 Ledger record。

来源: MCP 参考