SuperAPI AI 工具集

querying-well-data

数据与分析

查看项目

更新于 10-16 07:17

技能介绍

用途:Well 通过三个 MCP 工具暴露工作区的财务图谱,本技能说明如何正确查询。核心规则是先发现后查询:始终先调用 well_get_schema(root) 获取字段及类型与语义,再挑选所需字段调用 well_query_records,不要猜测字段名。字段路径以数组表示,如 "invoices.issuer.name" 对应 ["invoices","issuer","name"]。

主要工具:well_get_schema() 无参数列出全部根;well_get_schema({ root }) 列出一个根的字段;well_query_records({ root, fields, whereClause?, orderBy?, limit? }) 读取行;well_get_entity({ root, id }) 按 id 取单条记录。

可读的根:商业单据 invoices、invoice_items、invoice_transactions;当事方 companies、people、payment_means;银行 accounts、transactions、account_balances;会计图谱(只读,由 Well 管道过账)ledger_accounts、journals、journal_entries;参考数据 tax_rates、exchange_rates、categories、connectors;工作区 memberships、tasks、workspace_connectors。若打算从原始发票重建财务问题,应先检查 schema,已过账账本通常更准确。

过滤:whereClause 为 Hasura 风格布尔表达式,按 schema 中字段类型选运算符,数值/日期用 _eq、_gt、_lt、_gte、_lte,枚举用 _eq、_neq、_in、_nin、_is_null,文本用 _eq、_like、_ilike,关系可嵌套。

注意:读取自动限定在已认证工作区,无需传 workspace id;只选取所需字段(5–15 个)而非全部;商业单据金额为单据币种,跨币种汇总前检查 currency 字段与 exchange_rates。