@talonic/mcp 0.1.89 → 0.1.90
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/CHANGELOG.md +5 -0
- package/dist/http-server.js +470 -11
- package/dist/http-server.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.js +421 -8
- package/dist/index.js.map +1 -1
- package/dist/server.js +452 -11
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
> The publish workflow assigns the version on release; after the push that publishes it, promote this block to `## [<version>] - <date>` (the changelog lock accepts the current package version living here until then).
|
|
11
11
|
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **`talonic_submissions_*` tools (6), registered where the platform serves the Submissions app.** Reinsurance submission workbooks over `/v1/submissions/*`: `specs` (the workspace's target structures, labels awaiting review), `list` (inbox: cedent, status, values, facts, metrics, failed / warned checks; `spec_id`, `q`, `limit`, `offset`), `issues` (worklist: not captured, capture failed, not mapped, checks failed, labels to review, format metrics with no facts), `process` (capture and map in bulk: `only`, `document_ids`, `recapture`, `limit`, `dry_run`), `completeness` (one submission per format metric), `export` (facts in the client's long format with the source cell). Probe-gated like the Master Records tools (`GET /v1/submissions/specs` → 200).
|
|
15
|
+
|
|
12
16
|
## [0.1.89] - 2026-10-12
|
|
13
17
|
|
|
14
18
|
### Added
|
|
@@ -24,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
24
28
|
### Added
|
|
25
29
|
|
|
26
30
|
- **Take a batch of one pipeline's Agent tasks.** `talonic_list_agent_tasks` accepts `pipeline_id`; the list and claim descriptions tell an agent how to take N tasks (list available for the pipeline, claim each, skip a 409) and that `output_contract` carries each field's Spec rules (`description`) and allowed codes (`enumValues`).
|
|
31
|
+
- **`talonic_master_records_*` tools (8), registered where the platform serves the Master Records app.** Golden vendor / customer / material records across systems of record over `/v1/master-records/*`: `config` / `save_config` (whole-object replace, `dry_run`), `run` (resolve a domain now; deterministic, decisions kept), `overview` (latest run stats and multi-source records; filters: status, query, limit, offset), `get_record` (members per source, golden value per field with its sources, conflicts, link reasons), `decide` (accept / split / reopen), `changes` (change-log entries checked against evidence documents; `flagged` for the ones that need attention, with open-payables exposure), `crosswalk` (every source row to its golden record). Probe-gated like the AP tools (`GET /v1/master-records/config` → 200).
|
|
27
32
|
|
|
28
33
|
## [0.1.87] - 2026-10-11
|
|
29
34
|
|
package/dist/http-server.js
CHANGED
|
@@ -4968,6 +4968,435 @@ function registerPartiesTools(server, getToken, baseUrl) {
|
|
|
4968
4968
|
);
|
|
4969
4969
|
}
|
|
4970
4970
|
}
|
|
4971
|
+
var readOnly5 = {
|
|
4972
|
+
readOnlyHint: true,
|
|
4973
|
+
destructiveHint: false,
|
|
4974
|
+
idempotentHint: true,
|
|
4975
|
+
openWorldHint: false
|
|
4976
|
+
};
|
|
4977
|
+
var write5 = (idempotent, destructive = false) => ({
|
|
4978
|
+
readOnlyHint: false,
|
|
4979
|
+
destructiveHint: destructive,
|
|
4980
|
+
idempotentHint: idempotent,
|
|
4981
|
+
openWorldHint: false
|
|
4982
|
+
});
|
|
4983
|
+
var domainSchema = z.enum(["vendors", "customers", "materials"]).describe("Master data domain: vendors, customers or materials.");
|
|
4984
|
+
var domainPath = (domain, rest = "") => `/v1/master-records/${encodeURIComponent(domain)}${rest}`;
|
|
4985
|
+
var CONFIG_DESCRIPTION2 = [
|
|
4986
|
+
"Read the Master Records configuration: per domain (vendors, customers, materials) the source systems (label, SQL connection, the read-only SELECT aliasing columns to the canonical fields; order is survivorship priority), the match thresholds, and the optional change logs, open items and evidence Spec.",
|
|
4987
|
+
"USE WHEN: before changing the configuration, or to explain which systems feed a domain.",
|
|
4988
|
+
"NOT FOR: the golden records (talonic_master_records_overview).",
|
|
4989
|
+
"",
|
|
4990
|
+
"ARGS: none.",
|
|
4991
|
+
"RETURNS: { domains { vendors|customers|materials { sources[], auto_threshold?, review_threshold?, changes[]?, open_items[]?, evidence? } } }."
|
|
4992
|
+
].join("\n");
|
|
4993
|
+
function handleConfig2(getToken, baseUrl) {
|
|
4994
|
+
return runTool(() => apiJson(getToken, baseUrl, "GET", "/v1/master-records/config"));
|
|
4995
|
+
}
|
|
4996
|
+
var SAVE_CONFIG_DESCRIPTION2 = [
|
|
4997
|
+
"Replace the Master Records configuration with a complete new one (validated by the platform: every SQL is checked read-only against its connection). Run with dry_run first. Saving needs an owner.",
|
|
4998
|
+
"USE WHEN: setting up Master Records for a workspace, or adding a source system or change log.",
|
|
4999
|
+
"NOT FOR: partial edits; read talonic_master_records_config, change it, and send the whole object.",
|
|
5000
|
+
"",
|
|
5001
|
+
"ARGS: `config` (the whole configuration object), `dry_run` (validate only).",
|
|
5002
|
+
"RETURNS: { config, saved }. A broken config returns the list of problems."
|
|
5003
|
+
].join("\n");
|
|
5004
|
+
var saveConfigInputSchema2 = {
|
|
5005
|
+
config: z.record(z.string(), z.unknown()).describe("The whole Master Records configuration object (see talonic_master_records_config)."),
|
|
5006
|
+
dry_run: z.boolean().optional().describe("Validate only; nothing is saved.")
|
|
5007
|
+
};
|
|
5008
|
+
function handleSaveConfig2(getToken, baseUrl, args) {
|
|
5009
|
+
return runTool(
|
|
5010
|
+
() => apiJson(getToken, baseUrl, "PUT", "/v1/master-records/config", {
|
|
5011
|
+
body: { config: args.config, dry_run: args.dry_run ?? false }
|
|
5012
|
+
})
|
|
5013
|
+
);
|
|
5014
|
+
}
|
|
5015
|
+
var RUN_DESCRIPTION = [
|
|
5016
|
+
"Resolve a domain now: read every configured source, match rows across systems, and replace the domain's golden records. Earlier accept / split decisions are kept. Deterministic; running it again on the same data gives the same records.",
|
|
5017
|
+
"USE WHEN: the sources changed, or the domain has never been resolved.",
|
|
5018
|
+
"NOT FOR: reading the result (talonic_master_records_overview).",
|
|
5019
|
+
"",
|
|
5020
|
+
"ARGS: `domain` vendors|customers|materials.",
|
|
5021
|
+
"RETURNS: { run_id, stats { source_rows, records, multi_source, auto_merged, to_review, conflicts, bad_conflicts, per_source, pairs_compared, resolve_ms } }."
|
|
5022
|
+
].join("\n");
|
|
5023
|
+
var runInputSchema = { domain: domainSchema };
|
|
5024
|
+
function handleRun(getToken, baseUrl, args) {
|
|
5025
|
+
return runTool(() => apiJson(getToken, baseUrl, "POST", domainPath(args.domain, "/run")));
|
|
5026
|
+
}
|
|
5027
|
+
var OVERVIEW_DESCRIPTION2 = [
|
|
5028
|
+
"A domain's latest run (stats per source, records, merged, to review, conflicts) and its golden records that join two or more source rows, review and bank / tax id conflicts first, each with status, match score, member sources and conflicting fields.",
|
|
5029
|
+
'USE WHEN: the headline ("how many duplicates across the ERPs, how many need review") or finding a record by name or source id.',
|
|
5030
|
+
"NOT FOR: one record's fields and reasons (talonic_master_records_get_record); single-source rows (talonic_master_records_crosswalk).",
|
|
5031
|
+
"",
|
|
5032
|
+
"ARGS: `domain`, `status` review|auto|accepted|split|conflict|all (default all), `query` (name or source id contains), `limit` (default 100), `offset`.",
|
|
5033
|
+
"RETURNS: { domain, run { id, status, stats, started_at, finished_at }, total, records[] { key, name, member_count, status, score, conflict_level, sources[] { source, id }, conflict_fields[] } }."
|
|
5034
|
+
].join("\n");
|
|
5035
|
+
var overviewInputSchema = {
|
|
5036
|
+
domain: domainSchema,
|
|
5037
|
+
status: z.enum(["review", "auto", "accepted", "split", "conflict", "all"]).optional().describe("Only records with this status; conflict = any field disagreement."),
|
|
5038
|
+
query: z.string().max(200).optional().describe("Name or source id contains."),
|
|
5039
|
+
limit: z.number().int().min(1).max(5e3).optional().describe("Maximum records returned."),
|
|
5040
|
+
offset: z.number().int().min(0).optional().describe("Records to skip, for paging.")
|
|
5041
|
+
};
|
|
5042
|
+
function handleOverview2(getToken, baseUrl, args) {
|
|
5043
|
+
return runTool(
|
|
5044
|
+
() => apiJson(getToken, baseUrl, "GET", domainPath(args.domain, "/overview"), {
|
|
5045
|
+
params: { status: args.status, q: args.query, limit: args.limit, offset: args.offset }
|
|
5046
|
+
})
|
|
5047
|
+
);
|
|
5048
|
+
}
|
|
5049
|
+
var RECORD_DESCRIPTION = [
|
|
5050
|
+
"One golden record: each member row with its source and values, the golden value per field with the sources it came from, the fields where sources disagree (bank account and tax id are `bad`), the field-by-field reasons the rows were linked, status, score and any decision.",
|
|
5051
|
+
"USE WHEN: explaining why rows were merged, which system a value came from, or before accepting or splitting a record.",
|
|
5052
|
+
"NOT FOR: listing records (talonic_master_records_overview).",
|
|
5053
|
+
"",
|
|
5054
|
+
"ARGS: `domain`, `key` (from talonic_master_records_overview or talonic_master_records_crosswalk).",
|
|
5055
|
+
"RETURNS: { key, domain, name, members[] { source, id, values }, golden { <field> { value, from[] } }, conflicts[] { field, severity, values[] }, reasons[] { field, outcome, weight }, score, status, run_id, decision }."
|
|
5056
|
+
].join("\n");
|
|
5057
|
+
var recordInputSchema = {
|
|
5058
|
+
domain: domainSchema,
|
|
5059
|
+
key: z.string().min(1).describe("Golden record key.")
|
|
5060
|
+
};
|
|
5061
|
+
function handleGetRecord(getToken, baseUrl, args) {
|
|
5062
|
+
return runTool(
|
|
5063
|
+
() => apiJson(
|
|
5064
|
+
getToken,
|
|
5065
|
+
baseUrl,
|
|
5066
|
+
"GET",
|
|
5067
|
+
domainPath(args.domain, `/records/${encodeURIComponent(args.key)}`)
|
|
5068
|
+
)
|
|
5069
|
+
);
|
|
5070
|
+
}
|
|
5071
|
+
var DECIDE_DESCRIPTION2 = [
|
|
5072
|
+
"Decide a golden record: `accept` keeps the merge, `split` breaks it into one record per source row, `reopen` removes an earlier decision. The domain is re-resolved at once and the decision survives every later run.",
|
|
5073
|
+
"USE WHEN: the user has reviewed a record and asks to accept or split it.",
|
|
5074
|
+
"NOT FOR: looking at the record (talonic_master_records_get_record).",
|
|
5075
|
+
"",
|
|
5076
|
+
"ARGS: `domain`, `key`, `decision` accept|split|reopen.",
|
|
5077
|
+
"RETURNS: { key, decision, stats } (stats of the re-run)."
|
|
5078
|
+
].join("\n");
|
|
5079
|
+
var decideInputSchema2 = {
|
|
5080
|
+
domain: domainSchema,
|
|
5081
|
+
key: z.string().min(1).describe("Golden record key."),
|
|
5082
|
+
decision: z.enum(["accept", "split", "reopen"]).describe("accept, split or reopen.")
|
|
5083
|
+
};
|
|
5084
|
+
function handleDecide2(getToken, baseUrl, args) {
|
|
5085
|
+
return runTool(
|
|
5086
|
+
() => apiJson(
|
|
5087
|
+
getToken,
|
|
5088
|
+
baseUrl,
|
|
5089
|
+
"POST",
|
|
5090
|
+
domainPath(args.domain, `/records/${encodeURIComponent(args.key)}/decision`),
|
|
5091
|
+
{ body: { decision: args.decision } }
|
|
5092
|
+
)
|
|
5093
|
+
);
|
|
5094
|
+
}
|
|
5095
|
+
var CHANGES_DESCRIPTION = [
|
|
5096
|
+
"Master data changes from the source systems' change logs, each checked against the evidence documents: a bank account change `matches` when a document for the party names the new account, `contradicts` when documents name another, `no_document` otherwise; flagged bank changes carry the party's open payables across every source as `exposure`. Read live; nothing is stored.",
|
|
5097
|
+
'USE WHEN: "which bank detail changes have no document behind them", vendor bank fraud checks, terms changes.',
|
|
5098
|
+
"NOT FOR: the golden records (talonic_master_records_overview).",
|
|
5099
|
+
"",
|
|
5100
|
+
"ARGS: `domain`, `flagged` (only the changes that need attention).",
|
|
5101
|
+
"RETURNS: { domain, stats { changes, bank_changes, bank_matched, bank_contradicted, bank_no_document, terms_no_document, flagged, exposure, evidence_documents }, evidence_run, changes[] { source, id, field, old_value, new_value, changed_at, changed_by, golden_key, golden_name, verdict, flagged, evidence[], exposure, elsewhere[], explanation } }."
|
|
5102
|
+
].join("\n");
|
|
5103
|
+
var changesInputSchema = {
|
|
5104
|
+
domain: domainSchema,
|
|
5105
|
+
flagged: z.boolean().optional().describe("Only flagged changes.")
|
|
5106
|
+
};
|
|
5107
|
+
function handleChanges(getToken, baseUrl, args) {
|
|
5108
|
+
return runTool(
|
|
5109
|
+
() => apiJson(getToken, baseUrl, "GET", domainPath(args.domain, "/changes"), {
|
|
5110
|
+
params: { flagged: args.flagged ? "true" : void 0 }
|
|
5111
|
+
})
|
|
5112
|
+
);
|
|
5113
|
+
}
|
|
5114
|
+
var CROSSWALK_DESCRIPTION = [
|
|
5115
|
+
"The crosswalk: every source row (source, source id) mapped to its golden record key and name and the record's status, single-source rows included.",
|
|
5116
|
+
"USE WHEN: looking up which golden record a system's id belongs to, or handing the mapping to another system.",
|
|
5117
|
+
"NOT FOR: the merge reasons (talonic_master_records_get_record).",
|
|
5118
|
+
"",
|
|
5119
|
+
"ARGS: `domain`.",
|
|
5120
|
+
"RETURNS: { domain, rows[] { golden_key, golden_name, source, source_id, status } }."
|
|
5121
|
+
].join("\n");
|
|
5122
|
+
var crosswalkInputSchema = { domain: domainSchema };
|
|
5123
|
+
function handleCrosswalk(getToken, baseUrl, args) {
|
|
5124
|
+
return runTool(() => apiJson(getToken, baseUrl, "GET", domainPath(args.domain, "/crosswalk")));
|
|
5125
|
+
}
|
|
5126
|
+
async function probeMasterRecordsAccess(token, baseUrl) {
|
|
5127
|
+
try {
|
|
5128
|
+
const res = await fetch(buildUrl(baseUrl, "/v1/master-records/config"), {
|
|
5129
|
+
headers: { Authorization: `Bearer ${token}`, Accept: "application/json" },
|
|
5130
|
+
signal: AbortSignal.timeout(5e3)
|
|
5131
|
+
});
|
|
5132
|
+
return res.ok;
|
|
5133
|
+
} catch {
|
|
5134
|
+
return false;
|
|
5135
|
+
}
|
|
5136
|
+
}
|
|
5137
|
+
function registerMasterRecordsTools(server, getToken, baseUrl) {
|
|
5138
|
+
const tools = [
|
|
5139
|
+
[
|
|
5140
|
+
"talonic_master_records_config",
|
|
5141
|
+
"Read the Master Records configuration",
|
|
5142
|
+
CONFIG_DESCRIPTION2,
|
|
5143
|
+
{},
|
|
5144
|
+
readOnly5,
|
|
5145
|
+
() => handleConfig2(getToken, baseUrl)
|
|
5146
|
+
],
|
|
5147
|
+
[
|
|
5148
|
+
"talonic_master_records_save_config",
|
|
5149
|
+
"Save the Master Records configuration",
|
|
5150
|
+
SAVE_CONFIG_DESCRIPTION2,
|
|
5151
|
+
saveConfigInputSchema2,
|
|
5152
|
+
write5(true, true),
|
|
5153
|
+
(a) => handleSaveConfig2(getToken, baseUrl, a)
|
|
5154
|
+
],
|
|
5155
|
+
[
|
|
5156
|
+
"talonic_master_records_run",
|
|
5157
|
+
"Resolve master records",
|
|
5158
|
+
RUN_DESCRIPTION,
|
|
5159
|
+
runInputSchema,
|
|
5160
|
+
write5(true),
|
|
5161
|
+
(a) => handleRun(getToken, baseUrl, a)
|
|
5162
|
+
],
|
|
5163
|
+
[
|
|
5164
|
+
"talonic_master_records_overview",
|
|
5165
|
+
"Master records overview",
|
|
5166
|
+
OVERVIEW_DESCRIPTION2,
|
|
5167
|
+
overviewInputSchema,
|
|
5168
|
+
readOnly5,
|
|
5169
|
+
(a) => handleOverview2(getToken, baseUrl, a)
|
|
5170
|
+
],
|
|
5171
|
+
[
|
|
5172
|
+
"talonic_master_records_get_record",
|
|
5173
|
+
"One golden record",
|
|
5174
|
+
RECORD_DESCRIPTION,
|
|
5175
|
+
recordInputSchema,
|
|
5176
|
+
readOnly5,
|
|
5177
|
+
(a) => handleGetRecord(getToken, baseUrl, a)
|
|
5178
|
+
],
|
|
5179
|
+
[
|
|
5180
|
+
"talonic_master_records_decide",
|
|
5181
|
+
"Accept or split a golden record",
|
|
5182
|
+
DECIDE_DESCRIPTION2,
|
|
5183
|
+
decideInputSchema2,
|
|
5184
|
+
write5(true),
|
|
5185
|
+
(a) => handleDecide2(getToken, baseUrl, a)
|
|
5186
|
+
],
|
|
5187
|
+
[
|
|
5188
|
+
"talonic_master_records_changes",
|
|
5189
|
+
"Master data changes checked against documents",
|
|
5190
|
+
CHANGES_DESCRIPTION,
|
|
5191
|
+
changesInputSchema,
|
|
5192
|
+
readOnly5,
|
|
5193
|
+
(a) => handleChanges(getToken, baseUrl, a)
|
|
5194
|
+
],
|
|
5195
|
+
[
|
|
5196
|
+
"talonic_master_records_crosswalk",
|
|
5197
|
+
"Source id to golden record crosswalk",
|
|
5198
|
+
CROSSWALK_DESCRIPTION,
|
|
5199
|
+
crosswalkInputSchema,
|
|
5200
|
+
readOnly5,
|
|
5201
|
+
(a) => handleCrosswalk(getToken, baseUrl, a)
|
|
5202
|
+
]
|
|
5203
|
+
];
|
|
5204
|
+
for (const [name, title, description, inputSchema11, annotations, handler] of tools) {
|
|
5205
|
+
server.registerTool(
|
|
5206
|
+
name,
|
|
5207
|
+
{ title, description, inputSchema: inputSchema11, annotations: { title, ...annotations } },
|
|
5208
|
+
async (args) => handler(args)
|
|
5209
|
+
);
|
|
5210
|
+
}
|
|
5211
|
+
}
|
|
5212
|
+
var readOnly6 = {
|
|
5213
|
+
readOnlyHint: true,
|
|
5214
|
+
destructiveHint: false,
|
|
5215
|
+
idempotentHint: true,
|
|
5216
|
+
openWorldHint: false
|
|
5217
|
+
};
|
|
5218
|
+
var write6 = (idempotent, destructive = false) => ({
|
|
5219
|
+
readOnlyHint: false,
|
|
5220
|
+
destructiveHint: destructive,
|
|
5221
|
+
idempotentHint: idempotent,
|
|
5222
|
+
openWorldHint: false
|
|
5223
|
+
});
|
|
5224
|
+
var specId = z.string().uuid().describe("Target structure id (talonic_submissions_specs). Omit to use none.");
|
|
5225
|
+
var SPECS_DESCRIPTION = [
|
|
5226
|
+
"List the workspace's target structures: the client formats submissions are mapped into, with field count and how many label mappings still await review.",
|
|
5227
|
+
"USE WHEN: before any other submissions tool, to pick the spec_id.",
|
|
5228
|
+
"NOT FOR: the submissions themselves (talonic_submissions_list).",
|
|
5229
|
+
"",
|
|
5230
|
+
"ARGS: none.",
|
|
5231
|
+
"RETURNS: [{ id, name, updated_at, field_count, labels_to_review }]."
|
|
5232
|
+
].join("\n");
|
|
5233
|
+
function handleSpecs(getToken, baseUrl) {
|
|
5234
|
+
return runTool(() => apiJson(getToken, baseUrl, "GET", "/v1/submissions/specs"));
|
|
5235
|
+
}
|
|
5236
|
+
var LIST_DESCRIPTION = [
|
|
5237
|
+
"The inbox: every submission workbook of the workspace with its cedent, status (not_captured, captured, mapped, failed), captured values, facts and metrics under a target structure, and failed / warned checks.",
|
|
5238
|
+
'USE WHEN: the headline ("which submissions are in, which are mapped, which have problems") or finding a submission by file name.',
|
|
5239
|
+
"NOT FOR: what to fix (talonic_submissions_issues); the facts (talonic_submissions_export).",
|
|
5240
|
+
"",
|
|
5241
|
+
"ARGS: `spec_id` (optional), `q` (file name contains), `limit` (default 100, max 500), `offset`.",
|
|
5242
|
+
"RETURNS: { total, submissions[] { document_id, filename, cedent, status, tables, values, facts, metrics, checks_failed, checks_warned, embedded_files, captured_at } }."
|
|
5243
|
+
].join("\n");
|
|
5244
|
+
var listInputSchema = {
|
|
5245
|
+
spec_id: specId.optional(),
|
|
5246
|
+
q: z.string().optional().describe("File name contains."),
|
|
5247
|
+
limit: z.number().int().min(1).max(500).optional(),
|
|
5248
|
+
offset: z.number().int().min(0).optional()
|
|
5249
|
+
};
|
|
5250
|
+
function handleList(getToken, baseUrl, args) {
|
|
5251
|
+
return runTool(() => apiJson(getToken, baseUrl, "GET", "/v1/submissions", { params: args }));
|
|
5252
|
+
}
|
|
5253
|
+
var ISSUES_DESCRIPTION5 = [
|
|
5254
|
+
"The worklist: what needs a person, naming the submissions concerned. Kinds: not_captured, capture_failed, not_mapped, check_failed (with count), labels_to_review (with count), missing_metric (format metrics with no facts in a submission).",
|
|
5255
|
+
"USE WHEN: deciding what to do next; after talonic_submissions_process to see what is left.",
|
|
5256
|
+
"NOT FOR: the full list (talonic_submissions_list).",
|
|
5257
|
+
"",
|
|
5258
|
+
"ARGS: `spec_id` (optional; mapping-related kinds need it).",
|
|
5259
|
+
"RETURNS: [{ kind, document_id, filename, detail }]."
|
|
5260
|
+
].join("\n");
|
|
5261
|
+
var issuesInputSchema3 = { spec_id: specId.optional() };
|
|
5262
|
+
function handleIssues5(getToken, baseUrl, args) {
|
|
5263
|
+
return runTool(
|
|
5264
|
+
() => apiJson(getToken, baseUrl, "GET", "/v1/submissions/issues", { params: args })
|
|
5265
|
+
);
|
|
5266
|
+
}
|
|
5267
|
+
var PROCESS_DESCRIPTION = [
|
|
5268
|
+
"Capture new workbooks and map submissions into a target structure, in bulk. Capturing is deterministic (no model); mapping classifies only labels the workspace has not seen, and reuses every earlier and every human decision. Run with dry_run first.",
|
|
5269
|
+
"USE WHEN: new submissions arrived (only: not_captured), or a target structure changed and submissions need re-mapping (only: not_mapped or all).",
|
|
5270
|
+
"NOT FOR: reading results (talonic_submissions_list, talonic_submissions_issues).",
|
|
5271
|
+
"",
|
|
5272
|
+
"ARGS: `spec_id` (map into this structure), `document_ids` (restrict), `only` not_captured|not_mapped|all (default all), `recapture` (capture again even when captured; replaces earlier facts), `limit` (default 50, max 200), `dry_run`.",
|
|
5273
|
+
"RETURNS: dry_run \u2192 { plan[] { document_id, filename, capture, map } }; otherwise { results[] { document_id, ok, facts?, checks_failed?, error? } }."
|
|
5274
|
+
].join("\n");
|
|
5275
|
+
var processInputSchema = {
|
|
5276
|
+
spec_id: specId.optional(),
|
|
5277
|
+
document_ids: z.array(z.string().uuid()).max(200).optional(),
|
|
5278
|
+
only: z.enum(["not_captured", "not_mapped", "all"]).optional(),
|
|
5279
|
+
recapture: z.boolean().optional().describe("Capture again even when already captured; earlier facts are replaced."),
|
|
5280
|
+
limit: z.number().int().min(1).max(200).optional(),
|
|
5281
|
+
dry_run: z.boolean().optional().describe("List what would run; nothing runs.")
|
|
5282
|
+
};
|
|
5283
|
+
function handleProcess(getToken, baseUrl, args) {
|
|
5284
|
+
return runTool(
|
|
5285
|
+
() => apiJson(getToken, baseUrl, "POST", "/v1/submissions/process", { body: args })
|
|
5286
|
+
);
|
|
5287
|
+
}
|
|
5288
|
+
var COMPLETENESS_DESCRIPTION = [
|
|
5289
|
+
"One submission against a target structure: for every metric the client's format knows, how many facts the submission has and which fields they fill, plus metrics found that are not in the format.",
|
|
5290
|
+
"USE WHEN: judging whether a submission carries what a quote needs, or explaining what is missing.",
|
|
5291
|
+
"NOT FOR: the facts themselves (talonic_submissions_export).",
|
|
5292
|
+
"",
|
|
5293
|
+
"ARGS: `document_id`, `spec_id`.",
|
|
5294
|
+
"RETURNS: { metrics[] { metric, in_format, facts, fields[] } }."
|
|
5295
|
+
].join("\n");
|
|
5296
|
+
var completenessInputSchema = {
|
|
5297
|
+
document_id: z.string().uuid().describe("Submission (workbook document) id."),
|
|
5298
|
+
spec_id: specId
|
|
5299
|
+
};
|
|
5300
|
+
function handleCompleteness(getToken, baseUrl, args) {
|
|
5301
|
+
return runTool(
|
|
5302
|
+
() => apiJson(
|
|
5303
|
+
getToken,
|
|
5304
|
+
baseUrl,
|
|
5305
|
+
"GET",
|
|
5306
|
+
`/v1/submissions/${encodeURIComponent(args.document_id)}/completeness`,
|
|
5307
|
+
{
|
|
5308
|
+
params: { spec_id: args.spec_id }
|
|
5309
|
+
}
|
|
5310
|
+
)
|
|
5311
|
+
);
|
|
5312
|
+
}
|
|
5313
|
+
var EXPORT_DESCRIPTION = [
|
|
5314
|
+
"Facts in the client's long format: a header (the structure's fields, then Metric, Figure, Document, Source) and one row per figure; Source is the cell the figure came from. Large: prefer one document.",
|
|
5315
|
+
"USE WHEN: handing facts to the client or another system, or answering a question about figures.",
|
|
5316
|
+
"NOT FOR: the inbox (talonic_submissions_list).",
|
|
5317
|
+
"",
|
|
5318
|
+
"ARGS: `spec_id`, `document_id` (optional; all submissions when omitted).",
|
|
5319
|
+
"RETURNS: { header[], rows[][] }."
|
|
5320
|
+
].join("\n");
|
|
5321
|
+
var exportInputSchema = {
|
|
5322
|
+
spec_id: specId,
|
|
5323
|
+
document_id: z.string().uuid().optional().describe("Only this submission.")
|
|
5324
|
+
};
|
|
5325
|
+
function handleExport(getToken, baseUrl, args) {
|
|
5326
|
+
return runTool(
|
|
5327
|
+
() => apiJson(getToken, baseUrl, "GET", "/v1/submissions/export", { params: args })
|
|
5328
|
+
);
|
|
5329
|
+
}
|
|
5330
|
+
async function probeSubmissionsAccess(token, baseUrl) {
|
|
5331
|
+
try {
|
|
5332
|
+
const res = await fetch(buildUrl(baseUrl, "/v1/submissions/specs"), {
|
|
5333
|
+
headers: { Authorization: `Bearer ${token}`, Accept: "application/json" },
|
|
5334
|
+
signal: AbortSignal.timeout(5e3)
|
|
5335
|
+
});
|
|
5336
|
+
return res.ok;
|
|
5337
|
+
} catch {
|
|
5338
|
+
return false;
|
|
5339
|
+
}
|
|
5340
|
+
}
|
|
5341
|
+
function registerSubmissionsTools(server, getToken, baseUrl) {
|
|
5342
|
+
const tools = [
|
|
5343
|
+
[
|
|
5344
|
+
"talonic_submissions_specs",
|
|
5345
|
+
"Submission target structures",
|
|
5346
|
+
SPECS_DESCRIPTION,
|
|
5347
|
+
{},
|
|
5348
|
+
readOnly6,
|
|
5349
|
+
() => handleSpecs(getToken, baseUrl)
|
|
5350
|
+
],
|
|
5351
|
+
[
|
|
5352
|
+
"talonic_submissions_list",
|
|
5353
|
+
"Submissions inbox",
|
|
5354
|
+
LIST_DESCRIPTION,
|
|
5355
|
+
listInputSchema,
|
|
5356
|
+
readOnly6,
|
|
5357
|
+
(a) => handleList(getToken, baseUrl, a)
|
|
5358
|
+
],
|
|
5359
|
+
[
|
|
5360
|
+
"talonic_submissions_issues",
|
|
5361
|
+
"Submissions worklist",
|
|
5362
|
+
ISSUES_DESCRIPTION5,
|
|
5363
|
+
issuesInputSchema3,
|
|
5364
|
+
readOnly6,
|
|
5365
|
+
(a) => handleIssues5(getToken, baseUrl, a)
|
|
5366
|
+
],
|
|
5367
|
+
[
|
|
5368
|
+
"talonic_submissions_process",
|
|
5369
|
+
"Capture and map submissions",
|
|
5370
|
+
PROCESS_DESCRIPTION,
|
|
5371
|
+
processInputSchema,
|
|
5372
|
+
write6(true),
|
|
5373
|
+
(a) => handleProcess(getToken, baseUrl, a)
|
|
5374
|
+
],
|
|
5375
|
+
[
|
|
5376
|
+
"talonic_submissions_completeness",
|
|
5377
|
+
"Submission completeness",
|
|
5378
|
+
COMPLETENESS_DESCRIPTION,
|
|
5379
|
+
completenessInputSchema,
|
|
5380
|
+
readOnly6,
|
|
5381
|
+
(a) => handleCompleteness(getToken, baseUrl, a)
|
|
5382
|
+
],
|
|
5383
|
+
[
|
|
5384
|
+
"talonic_submissions_export",
|
|
5385
|
+
"Export submission facts",
|
|
5386
|
+
EXPORT_DESCRIPTION,
|
|
5387
|
+
exportInputSchema,
|
|
5388
|
+
readOnly6,
|
|
5389
|
+
(a) => handleExport(getToken, baseUrl, a)
|
|
5390
|
+
]
|
|
5391
|
+
];
|
|
5392
|
+
for (const [name, title, description, inputSchema11, annotations, handler] of tools) {
|
|
5393
|
+
server.registerTool(
|
|
5394
|
+
name,
|
|
5395
|
+
{ title, description, inputSchema: inputSchema11, annotations: { title, ...annotations } },
|
|
5396
|
+
async (args) => handler(args)
|
|
5397
|
+
);
|
|
5398
|
+
}
|
|
5399
|
+
}
|
|
4971
5400
|
var DEFAULT_BASE3 = "https://api.talonic.com";
|
|
4972
5401
|
var TASK_STATUSES = ["available", "claimed", "submitted", "timed_out", "cancelled"];
|
|
4973
5402
|
var taskId = z.string().uuid().describe("Agent task UUID.");
|
|
@@ -5716,7 +6145,7 @@ async function resolveFieldId(getToken, baseUrl, args) {
|
|
|
5716
6145
|
resolution: { matched_by: resolved.matched_by, redirected_from: resolved.redirected_from }
|
|
5717
6146
|
};
|
|
5718
6147
|
}
|
|
5719
|
-
var
|
|
6148
|
+
var LIST_DESCRIPTION2 = [
|
|
5720
6149
|
"List the workspace's Field Registry \u2014 the canonical concepts Talonic has discovered across every ingested document, each with a stable id, maturity level, data type, synonyms and occurrence count.",
|
|
5721
6150
|
"",
|
|
5722
6151
|
"USE WHEN: you need to know WHAT data exists before querying it, want to pick the right concept for a question, or need the exact field id for talonic_get_field / talonic_field_values.",
|
|
@@ -5830,7 +6259,7 @@ function registerFieldTools(server, getToken, baseUrl) {
|
|
|
5830
6259
|
"talonic_list_fields",
|
|
5831
6260
|
{
|
|
5832
6261
|
title: "List Registry Fields",
|
|
5833
|
-
description:
|
|
6262
|
+
description: LIST_DESCRIPTION2,
|
|
5834
6263
|
inputSchema: listFieldsInputSchema,
|
|
5835
6264
|
annotations: {
|
|
5836
6265
|
title: "List Registry Fields",
|
|
@@ -6052,7 +6481,7 @@ function registerAgentRegistryTools(server, getToken, baseUrl, opts = {}) {
|
|
|
6052
6481
|
async (args) => handleInvokeAgentTool(getToken, baseUrl, args)
|
|
6053
6482
|
);
|
|
6054
6483
|
}
|
|
6055
|
-
var
|
|
6484
|
+
var LIST_DESCRIPTION3 = [
|
|
6056
6485
|
"List the workspace's Specs \u2014 the configured pipelines (rail + fields) that talonic_run_spec executes. Each row: id, name, description, schema_id (the schema a run materializes onto \u2014 a DIFFERENT id from the Spec's), version / materialized_version (null = never published), field_count, node_count, timestamps.",
|
|
6057
6486
|
"",
|
|
6058
6487
|
"USE WHEN: the user wants to run 'their pipeline' / 'the invoice Spec', or you need a spec_id for talonic_run_spec / talonic_get_spec.",
|
|
@@ -6112,7 +6541,7 @@ function registerSpecTools(server, getToken, baseUrl) {
|
|
|
6112
6541
|
"talonic_list_specs",
|
|
6113
6542
|
{
|
|
6114
6543
|
title: "List Specs",
|
|
6115
|
-
description:
|
|
6544
|
+
description: LIST_DESCRIPTION3,
|
|
6116
6545
|
inputSchema: listSpecsInputSchema,
|
|
6117
6546
|
annotations: { title: "List Specs", ...READ_ONLY4 },
|
|
6118
6547
|
_meta: widgetToolMeta("listSpecs")
|
|
@@ -6137,7 +6566,7 @@ function mapRunStatus(raw) {
|
|
|
6137
6566
|
return "failed";
|
|
6138
6567
|
return "processing";
|
|
6139
6568
|
}
|
|
6140
|
-
var
|
|
6569
|
+
var RUN_DESCRIPTION2 = [
|
|
6141
6570
|
"Run a Spec \u2014 the customer's configured pipeline \u2014 over documents, in one call. Two inputs: `document_ids` (documents already in the workspace; for a new file, first talonic_request_upload \u2192 poll talonic_get_document until completed) OR `file_urls` (public https files, max 20; Talonic ingests them first). Consumes credits.",
|
|
6142
6571
|
"",
|
|
6143
6572
|
"USE WHEN: the user wants to 'run the invoice pipeline on these documents', process files through their Spec, or produce the Spec's structured rows.",
|
|
@@ -6352,7 +6781,7 @@ function registerRunTools(server, getToken, baseUrl) {
|
|
|
6352
6781
|
"talonic_run_spec",
|
|
6353
6782
|
{
|
|
6354
6783
|
title: "Run a Spec pipeline",
|
|
6355
|
-
description:
|
|
6784
|
+
description: RUN_DESCRIPTION2,
|
|
6356
6785
|
inputSchema: runSpecInputSchema,
|
|
6357
6786
|
annotations: {
|
|
6358
6787
|
title: "Run a Spec pipeline",
|
|
@@ -6526,7 +6955,7 @@ function registerAskTools(server, getToken, baseUrl) {
|
|
|
6526
6955
|
|
|
6527
6956
|
// package.json
|
|
6528
6957
|
var package_default = {
|
|
6529
|
-
version: "0.1.
|
|
6958
|
+
version: "0.1.90"};
|
|
6530
6959
|
|
|
6531
6960
|
// src/version.ts
|
|
6532
6961
|
var VERSION = package_default.version;
|
|
@@ -6579,7 +7008,7 @@ function buildServerInstructions(opts) {
|
|
|
6579
7008
|
"apps:decide consent and a senior_member role or above; if a decision tool is marked",
|
|
6580
7009
|
"not invocable in this session, or a call returns 403, tell the user which consent or",
|
|
6581
7010
|
"role is missing instead of retrying.",
|
|
6582
|
-
"Tools that change workspace data (saving schemas, contract and
|
|
7011
|
+
"Tools that change workspace data (saving schemas, contract, AP and master record updates, decisions)",
|
|
6583
7012
|
"should only be called when the user asked for that change."
|
|
6584
7013
|
].join(" ");
|
|
6585
7014
|
}
|
|
@@ -6689,6 +7118,12 @@ function createServer(options) {
|
|
|
6689
7118
|
if (options.includePartiesTools) {
|
|
6690
7119
|
registerPartiesTools(server, rawToken, baseUrl);
|
|
6691
7120
|
}
|
|
7121
|
+
if (options.includeMasterRecordsTools) {
|
|
7122
|
+
registerMasterRecordsTools(server, rawToken, baseUrl);
|
|
7123
|
+
}
|
|
7124
|
+
if (options.includeSubmissionsTools) {
|
|
7125
|
+
registerSubmissionsTools(server, rawToken, baseUrl);
|
|
7126
|
+
}
|
|
6692
7127
|
registerSchemasResource(server, getTalonic);
|
|
6693
7128
|
registerWebhooksResource(server, rawToken, baseUrl);
|
|
6694
7129
|
registerWidgets(server);
|
|
@@ -6740,6 +7175,24 @@ async function apAccessCached(token, probe = (t) => probeApAccess(t, process.env
|
|
|
6740
7175
|
apProbeCache.set(token, { ok, expiresAt: now() + GROWTH_PROBE_TTL_MS });
|
|
6741
7176
|
return ok;
|
|
6742
7177
|
}
|
|
7178
|
+
var masterRecordsProbeCache = /* @__PURE__ */ new Map();
|
|
7179
|
+
async function masterRecordsAccessCached(token, probe = (t) => probeMasterRecordsAccess(t, process.env["TALONIC_BASE_URL"]), now = Date.now) {
|
|
7180
|
+
const hit = masterRecordsProbeCache.get(token);
|
|
7181
|
+
if (hit && hit.expiresAt > now()) return hit.ok;
|
|
7182
|
+
const ok = await probe(token);
|
|
7183
|
+
if (masterRecordsProbeCache.size >= 1e3) masterRecordsProbeCache.clear();
|
|
7184
|
+
masterRecordsProbeCache.set(token, { ok, expiresAt: now() + GROWTH_PROBE_TTL_MS });
|
|
7185
|
+
return ok;
|
|
7186
|
+
}
|
|
7187
|
+
var submissionsProbeCache = /* @__PURE__ */ new Map();
|
|
7188
|
+
async function submissionsAccessCached(token, probe = (t) => probeSubmissionsAccess(t, process.env["TALONIC_BASE_URL"]), now = Date.now) {
|
|
7189
|
+
const hit = submissionsProbeCache.get(token);
|
|
7190
|
+
if (hit && hit.expiresAt > now()) return hit.ok;
|
|
7191
|
+
const ok = await probe(token);
|
|
7192
|
+
if (submissionsProbeCache.size >= 1e3) submissionsProbeCache.clear();
|
|
7193
|
+
submissionsProbeCache.set(token, { ok, expiresAt: now() + GROWTH_PROBE_TTL_MS });
|
|
7194
|
+
return ok;
|
|
7195
|
+
}
|
|
6743
7196
|
var docGenProbeCache = /* @__PURE__ */ new Map();
|
|
6744
7197
|
async function docGenAccessCached(token, probe = (t) => probeDocGenAccess(t, process.env["TALONIC_BASE_URL"]), now = Date.now) {
|
|
6745
7198
|
const hit = docGenProbeCache.get(token);
|
|
@@ -7021,7 +7474,9 @@ function createRequestHandler(options = {}) {
|
|
|
7021
7474
|
includeContractsTools,
|
|
7022
7475
|
includeApTools,
|
|
7023
7476
|
includeDocGenTools,
|
|
7024
|
-
includePartiesTools
|
|
7477
|
+
includePartiesTools,
|
|
7478
|
+
includeMasterRecordsTools,
|
|
7479
|
+
includeSubmissionsTools
|
|
7025
7480
|
] = await Promise.all([
|
|
7026
7481
|
(options.growthAccess ?? ((currentToken) => growthAccessCached(
|
|
7027
7482
|
currentToken,
|
|
@@ -7038,7 +7493,9 @@ function createRequestHandler(options = {}) {
|
|
|
7038
7493
|
(options.docGenAccess ?? ((currentToken) => docGenAccessCached(currentToken)))(token),
|
|
7039
7494
|
(options.partiesAccess ?? ((currentToken) => partiesAccessCached(currentToken)))(
|
|
7040
7495
|
token
|
|
7041
|
-
)
|
|
7496
|
+
),
|
|
7497
|
+
(options.masterRecordsAccess ?? ((currentToken) => masterRecordsAccessCached(currentToken)))(token),
|
|
7498
|
+
(options.submissionsAccess ?? ((currentToken) => submissionsAccessCached(currentToken)))(token)
|
|
7042
7499
|
]);
|
|
7043
7500
|
const mcpServer = createServer({
|
|
7044
7501
|
tokenProvider: () => token,
|
|
@@ -7048,6 +7505,8 @@ function createRequestHandler(options = {}) {
|
|
|
7048
7505
|
includeApTools,
|
|
7049
7506
|
includeDocGenTools,
|
|
7050
7507
|
includePartiesTools,
|
|
7508
|
+
includeMasterRecordsTools,
|
|
7509
|
+
includeSubmissionsTools,
|
|
7051
7510
|
...process.env["TALONIC_BASE_URL"] ? { baseUrl: process.env["TALONIC_BASE_URL"] } : {},
|
|
7052
7511
|
// Listing UX only: an OAuth token that visibly lacks apps:decide gets
|
|
7053
7512
|
// the decision-task tools marked non-invocable. The platform decides.
|
|
@@ -7086,6 +7545,6 @@ if (isDirectInvocation()) {
|
|
|
7086
7545
|
});
|
|
7087
7546
|
}
|
|
7088
7547
|
|
|
7089
|
-
export { adminAgentTaskAccessCached, apAccessCached, contractsAccessCached, createRequestHandler, docGenAccessCached, growthAccessCached, isOpenAiClient, partiesAccessCached };
|
|
7548
|
+
export { adminAgentTaskAccessCached, apAccessCached, contractsAccessCached, createRequestHandler, docGenAccessCached, growthAccessCached, isOpenAiClient, masterRecordsAccessCached, partiesAccessCached, submissionsAccessCached };
|
|
7090
7549
|
//# sourceMappingURL=http-server.js.map
|
|
7091
7550
|
//# sourceMappingURL=http-server.js.map
|