@talonic/mcp 0.1.67 → 0.1.69
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/dist/http-server.js +136 -35
- package/dist/http-server.js.map +1 -1
- package/dist/index.js +136 -35
- package/dist/index.js.map +1 -1
- package/dist/server.js +136 -35
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
package/dist/server.js
CHANGED
|
@@ -1088,6 +1088,105 @@ function registerGetBalance(server, getTalonic) {
|
|
|
1088
1088
|
);
|
|
1089
1089
|
}
|
|
1090
1090
|
var DESCRIPTION4 = [
|
|
1091
|
+
"Read Talonic's machine-readable credit pricing catalog: fixed per-unit rates so you can predict spend BEFORE running anything.",
|
|
1092
|
+
"",
|
|
1093
|
+
"USE WHEN: estimating the cost of a planned extraction/structuring/matching job, or answering a pricing question. Public \u2014 works without spending credits.",
|
|
1094
|
+
"NOT FOR: the workspace's current balance (use talonic_get_balance) or what it has already spent (use talonic_get_usage).",
|
|
1095
|
+
"ARGS: none.",
|
|
1096
|
+
"RETURNS: currency, credits_per_eur, multipliers (e.g. batch 0.5x), and units[] \u2014 each { unit, label, credits, eur, free }."
|
|
1097
|
+
].join("\n");
|
|
1098
|
+
var inputSchema4 = {};
|
|
1099
|
+
var outputSchema4 = {
|
|
1100
|
+
currency: z.string().describe("Billing currency (always EUR)."),
|
|
1101
|
+
credits_per_eur: z.number().describe("Credits per EUR (e.g. 1000 = \u20AC1)."),
|
|
1102
|
+
multipliers: z.record(z.string(), z.number()).describe(
|
|
1103
|
+
"Processing-mode multipliers applied on top of per-unit cost (e.g. { realtime: 1, batch: 0.5 })."
|
|
1104
|
+
),
|
|
1105
|
+
units: z.array(
|
|
1106
|
+
z.object({
|
|
1107
|
+
unit: z.string().describe("Billable unit identifier."),
|
|
1108
|
+
label: z.string().describe("Human-readable label."),
|
|
1109
|
+
credits: z.number().describe("Credits per unit (0 = free)."),
|
|
1110
|
+
eur: z.number().describe("EUR per unit."),
|
|
1111
|
+
free: z.boolean().describe("Whether the unit is free.")
|
|
1112
|
+
})
|
|
1113
|
+
).describe("The per-unit pricing catalog.")
|
|
1114
|
+
};
|
|
1115
|
+
async function handleGetPricing(talonic) {
|
|
1116
|
+
try {
|
|
1117
|
+
const result = await talonic.pricing.get();
|
|
1118
|
+
return jsonOk(result);
|
|
1119
|
+
} catch (err) {
|
|
1120
|
+
return toolError(err);
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
function registerGetPricing(server, getTalonic) {
|
|
1124
|
+
server.registerTool(
|
|
1125
|
+
"talonic_get_pricing",
|
|
1126
|
+
{
|
|
1127
|
+
title: "Get Talonic Pricing",
|
|
1128
|
+
description: DESCRIPTION4,
|
|
1129
|
+
inputSchema: inputSchema4,
|
|
1130
|
+
outputSchema: outputSchema4,
|
|
1131
|
+
annotations: {
|
|
1132
|
+
title: "Get Talonic Pricing",
|
|
1133
|
+
readOnlyHint: true,
|
|
1134
|
+
destructiveHint: false,
|
|
1135
|
+
openWorldHint: false
|
|
1136
|
+
}
|
|
1137
|
+
},
|
|
1138
|
+
async () => handleGetPricing(getTalonic())
|
|
1139
|
+
);
|
|
1140
|
+
}
|
|
1141
|
+
var DESCRIPTION5 = [
|
|
1142
|
+
"Read the workspace's per-function credit consumption over a trailing window: where the credits actually went.",
|
|
1143
|
+
"",
|
|
1144
|
+
"USE WHEN: the user asks what they have spent credits on, or you want to see which function (extraction, structuring, intelligence ops) dominates spend.",
|
|
1145
|
+
"NOT FOR: the remaining balance (use talonic_get_balance) or per-unit rates (use talonic_get_pricing).",
|
|
1146
|
+
"ARGS: days (optional, default 30, clamped 1-365).",
|
|
1147
|
+
"RETURNS: period_days, total_credits, and by_function[] \u2014 each { operation_type, operations, credits }, highest spend first."
|
|
1148
|
+
].join("\n");
|
|
1149
|
+
var inputSchema5 = {
|
|
1150
|
+
days: z.number().int().min(1).max(365).optional().describe("Trailing window in days (default 30).")
|
|
1151
|
+
};
|
|
1152
|
+
var outputSchema5 = {
|
|
1153
|
+
period_days: z.number().describe("Length of the reporting window in days."),
|
|
1154
|
+
total_credits: z.number().describe("Total credits consumed across all functions in the window."),
|
|
1155
|
+
by_function: z.array(
|
|
1156
|
+
z.object({
|
|
1157
|
+
operation_type: z.string().describe("Platform function / billable operation type."),
|
|
1158
|
+
operations: z.number().describe("Number of charged operations of this type."),
|
|
1159
|
+
credits: z.number().describe("Total credits consumed by this function.")
|
|
1160
|
+
})
|
|
1161
|
+
).describe("Per-function breakdown, highest spend first.")
|
|
1162
|
+
};
|
|
1163
|
+
async function handleGetUsage(talonic, days) {
|
|
1164
|
+
try {
|
|
1165
|
+
const result = await talonic.usage.getByFunction(days);
|
|
1166
|
+
return jsonOk(result);
|
|
1167
|
+
} catch (err) {
|
|
1168
|
+
return toolError(err);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
function registerGetUsage(server, getTalonic) {
|
|
1172
|
+
server.registerTool(
|
|
1173
|
+
"talonic_get_usage",
|
|
1174
|
+
{
|
|
1175
|
+
title: "Get Talonic Usage",
|
|
1176
|
+
description: DESCRIPTION5,
|
|
1177
|
+
inputSchema: inputSchema5,
|
|
1178
|
+
outputSchema: outputSchema5,
|
|
1179
|
+
annotations: {
|
|
1180
|
+
title: "Get Talonic Usage",
|
|
1181
|
+
readOnlyHint: true,
|
|
1182
|
+
destructiveHint: false,
|
|
1183
|
+
openWorldHint: false
|
|
1184
|
+
}
|
|
1185
|
+
},
|
|
1186
|
+
async (args) => handleGetUsage(getTalonic(), args.days)
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
1189
|
+
var DESCRIPTION6 = [
|
|
1091
1190
|
"Fetch a single document's metadata and processing status from the workspace.",
|
|
1092
1191
|
"",
|
|
1093
1192
|
"USE WHEN: 'tell me about document X', or to poll status after talonic_request_upload until the file is ready.",
|
|
@@ -1096,12 +1195,12 @@ var DESCRIPTION4 = [
|
|
|
1096
1195
|
"ARGS: document_id.",
|
|
1097
1196
|
"RETURNS: filename, pages, type_detected, language, and `status`. Status lifecycle: pending_upload -> queued -> extracting -> completed. Wait for `completed` before calling talonic_extract on a freshly uploaded doc. To read the document's text, call talonic_to_markdown with this id."
|
|
1098
1197
|
].join("\n");
|
|
1099
|
-
var
|
|
1198
|
+
var inputSchema6 = {
|
|
1100
1199
|
document_id: z.string().min(1).describe(
|
|
1101
1200
|
"The Talonic document ID. Get this from a previous talonic_extract or talonic_search response."
|
|
1102
1201
|
)
|
|
1103
1202
|
};
|
|
1104
|
-
var
|
|
1203
|
+
var outputSchema6 = {
|
|
1105
1204
|
id: z.string(),
|
|
1106
1205
|
// Freshly-uploaded / pre-extraction documents (browser-handoff polling) return
|
|
1107
1206
|
// null for these until OCR/ingest computes them. They MUST accept null, or the
|
|
@@ -1164,9 +1263,9 @@ function registerGetDocument(server, getTalonic) {
|
|
|
1164
1263
|
"talonic_get_document",
|
|
1165
1264
|
{
|
|
1166
1265
|
title: "Get Talonic Document",
|
|
1167
|
-
description:
|
|
1168
|
-
inputSchema:
|
|
1169
|
-
outputSchema:
|
|
1266
|
+
description: DESCRIPTION6,
|
|
1267
|
+
inputSchema: inputSchema6,
|
|
1268
|
+
outputSchema: outputSchema6,
|
|
1170
1269
|
annotations: {
|
|
1171
1270
|
title: "Get Talonic Document",
|
|
1172
1271
|
readOnlyHint: true,
|
|
@@ -1181,7 +1280,7 @@ function registerGetDocument(server, getTalonic) {
|
|
|
1181
1280
|
async (args) => handleGetDocument(getTalonic(), args)
|
|
1182
1281
|
);
|
|
1183
1282
|
}
|
|
1184
|
-
var
|
|
1283
|
+
var DESCRIPTION7 = [
|
|
1185
1284
|
"List the saved schemas in the workspace as compact summaries (id, short_id, name, description, version, field_count).",
|
|
1186
1285
|
"",
|
|
1187
1286
|
"USE WHEN: 'what schemas do I have', or to find a reusable schema before extracting.",
|
|
@@ -1207,7 +1306,7 @@ var schemaItem = z.object({
|
|
|
1207
1306
|
dashboard: z.string().optional()
|
|
1208
1307
|
}).optional()
|
|
1209
1308
|
});
|
|
1210
|
-
var
|
|
1309
|
+
var outputSchema7 = {
|
|
1211
1310
|
data: z.array(schemaItem).describe("Saved schemas in the workspace."),
|
|
1212
1311
|
pagination: z.object({
|
|
1213
1312
|
total: z.number().optional(),
|
|
@@ -1237,9 +1336,9 @@ function registerListSchemas(server, getTalonic) {
|
|
|
1237
1336
|
"talonic_list_schemas",
|
|
1238
1337
|
{
|
|
1239
1338
|
title: "List Talonic Schemas",
|
|
1240
|
-
description:
|
|
1339
|
+
description: DESCRIPTION7,
|
|
1241
1340
|
inputSchema: {},
|
|
1242
|
-
outputSchema:
|
|
1341
|
+
outputSchema: outputSchema7,
|
|
1243
1342
|
annotations: {
|
|
1244
1343
|
title: "List Talonic Schemas",
|
|
1245
1344
|
readOnlyHint: true,
|
|
@@ -1254,7 +1353,7 @@ function registerListSchemas(server, getTalonic) {
|
|
|
1254
1353
|
async () => handleListSchemas(getTalonic())
|
|
1255
1354
|
);
|
|
1256
1355
|
}
|
|
1257
|
-
var
|
|
1356
|
+
var DESCRIPTION8 = [
|
|
1258
1357
|
"Save a reusable schema to the workspace for use across future extractions.",
|
|
1259
1358
|
"",
|
|
1260
1359
|
"USE WHEN: the user confirms a schema/template they want to reuse across documents.",
|
|
@@ -1262,14 +1361,14 @@ var DESCRIPTION6 = [
|
|
|
1262
1361
|
"ARGS: `name`; `definition` \u2014 a JSON Schema ({type:'object',properties:{...}}) or a flat {field:'type'} map.",
|
|
1263
1362
|
"RETURNS: the saved schema with id and short_id. Pass either to talonic_extract as `schema_id`."
|
|
1264
1363
|
].join("\n");
|
|
1265
|
-
var
|
|
1364
|
+
var inputSchema7 = {
|
|
1266
1365
|
name: z.string().min(1).describe("Human-readable name for the schema, e.g. 'Standard Invoice'."),
|
|
1267
1366
|
definition: z.record(z.string(), z.unknown()).describe(
|
|
1268
1367
|
"Schema definition. Most reliable: full JSON Schema {type:'object', properties:{...}}. Also accepted: a flat key-type map {field_name:'string', amount:'number'} which the API normalises."
|
|
1269
1368
|
),
|
|
1270
1369
|
description: z.string().optional().describe("Optional description of what this schema extracts and when to use it.")
|
|
1271
1370
|
};
|
|
1272
|
-
var
|
|
1371
|
+
var outputSchema8 = {
|
|
1273
1372
|
id: z.string().describe("UUID of the newly saved schema."),
|
|
1274
1373
|
short_id: z.string().optional().describe("Human-readable short id (SCH-XXXXXXXX)."),
|
|
1275
1374
|
name: z.string(),
|
|
@@ -1304,9 +1403,9 @@ function registerSaveSchema(server, getTalonic) {
|
|
|
1304
1403
|
"talonic_save_schema",
|
|
1305
1404
|
{
|
|
1306
1405
|
title: "Save Talonic Schema",
|
|
1307
|
-
description:
|
|
1308
|
-
inputSchema:
|
|
1309
|
-
outputSchema:
|
|
1406
|
+
description: DESCRIPTION8,
|
|
1407
|
+
inputSchema: inputSchema7,
|
|
1408
|
+
outputSchema: outputSchema8,
|
|
1310
1409
|
annotations: {
|
|
1311
1410
|
title: "Save Talonic Schema",
|
|
1312
1411
|
readOnlyHint: false,
|
|
@@ -1321,7 +1420,7 @@ function registerSaveSchema(server, getTalonic) {
|
|
|
1321
1420
|
async (args) => handleSaveSchema(getTalonic(), args)
|
|
1322
1421
|
);
|
|
1323
1422
|
}
|
|
1324
|
-
var
|
|
1423
|
+
var DESCRIPTION9 = [
|
|
1325
1424
|
"Find documents, fields, schemas, or sources in the workspace. One call returns ranked results across all types.",
|
|
1326
1425
|
"",
|
|
1327
1426
|
"MATCHING IS LITERAL KEYWORD, not semantic. Query with ONE short SINGULAR term or an exact filename: 'invoice', 'bank statement', 'sample-invoice.pdf'. Sentences ('documents related to invoices') and plurals ('invoices') return empty. If a search comes back empty, retry with a shorter singular keyword before concluding the workspace has nothing.",
|
|
@@ -1330,13 +1429,13 @@ var DESCRIPTION7 = [
|
|
|
1330
1429
|
"ARGS: query (short literal keyword); optional limit.",
|
|
1331
1430
|
"RETURNS: documents[], fields[]/fieldMatches[] (only `filterable: true` entries work in talonic_filter), schemas[], sources[]. Use the id from documents[] to act on a named file."
|
|
1332
1431
|
].join("\n");
|
|
1333
|
-
var
|
|
1432
|
+
var inputSchema8 = {
|
|
1334
1433
|
query: z.string().min(1).describe(
|
|
1335
1434
|
"ONE short, SINGULAR keyword or an exact filename \u2014 'invoice', 'insurance certificate', 'sample-invoice.pdf'. Matching is literal: sentences and plurals return empty."
|
|
1336
1435
|
),
|
|
1337
1436
|
limit: z.number().int().positive().optional().describe("Maximum results per entity type. Default: 5. Increase for broader exploration.")
|
|
1338
1437
|
};
|
|
1339
|
-
var
|
|
1438
|
+
var outputSchema9 = {
|
|
1340
1439
|
documents: z.array(
|
|
1341
1440
|
z.object({
|
|
1342
1441
|
id: z.string(),
|
|
@@ -1405,9 +1504,9 @@ function registerSearch(server, getTalonic) {
|
|
|
1405
1504
|
"talonic_search",
|
|
1406
1505
|
{
|
|
1407
1506
|
title: "Search Talonic Workspace",
|
|
1408
|
-
description:
|
|
1409
|
-
inputSchema:
|
|
1410
|
-
outputSchema:
|
|
1507
|
+
description: DESCRIPTION9,
|
|
1508
|
+
inputSchema: inputSchema8,
|
|
1509
|
+
outputSchema: outputSchema9,
|
|
1411
1510
|
annotations: {
|
|
1412
1511
|
title: "Search Talonic Workspace",
|
|
1413
1512
|
readOnlyHint: true,
|
|
@@ -1422,7 +1521,7 @@ function registerSearch(server, getTalonic) {
|
|
|
1422
1521
|
async (args) => handleSearch(getTalonic(), args)
|
|
1423
1522
|
);
|
|
1424
1523
|
}
|
|
1425
|
-
var
|
|
1524
|
+
var DESCRIPTION10 = [
|
|
1426
1525
|
"Get a browser upload link the user opens to add a file to their workspace. Returns the link plus a pre-allocated document_id.",
|
|
1427
1526
|
"",
|
|
1428
1527
|
"USE WHEN: the user wants to upload a document and you cannot pass it directly \u2014 hosted/sandboxed clients (ChatGPT, Claude.ai) or files too large for tool-call arguments.",
|
|
@@ -1430,12 +1529,12 @@ var DESCRIPTION8 = [
|
|
|
1430
1529
|
"ARGS: filename (with extension).",
|
|
1431
1530
|
"RETURNS: upload_url, document_id, expires_at. After the user uploads, poll talonic_get_document on that document_id until status is 'completed', then call talonic_extract."
|
|
1432
1531
|
].join("\n");
|
|
1433
|
-
var
|
|
1532
|
+
var inputSchema9 = {
|
|
1434
1533
|
filename: z.string().min(1).describe(
|
|
1435
1534
|
"The name of the file being uploaded, including extension (e.g. 'invoice.pdf'). Used to pre-allocate the document and infer MIME type."
|
|
1436
1535
|
)
|
|
1437
1536
|
};
|
|
1438
|
-
var
|
|
1537
|
+
var outputSchema10 = {
|
|
1439
1538
|
document_id: z.string().describe(
|
|
1440
1539
|
"The pre-allocated document ID. Use with talonic_get_document to poll status, and with talonic_extract once uploaded."
|
|
1441
1540
|
),
|
|
@@ -1476,9 +1575,9 @@ function registerRequestUpload(server, getToken, baseUrl) {
|
|
|
1476
1575
|
"talonic_request_upload",
|
|
1477
1576
|
{
|
|
1478
1577
|
title: "Request File Upload",
|
|
1479
|
-
description:
|
|
1480
|
-
inputSchema:
|
|
1481
|
-
outputSchema:
|
|
1578
|
+
description: DESCRIPTION10,
|
|
1579
|
+
inputSchema: inputSchema9,
|
|
1580
|
+
outputSchema: outputSchema10,
|
|
1482
1581
|
annotations: {
|
|
1483
1582
|
title: "Request File Upload",
|
|
1484
1583
|
readOnlyHint: false,
|
|
@@ -1493,7 +1592,7 @@ function registerRequestUpload(server, getToken, baseUrl) {
|
|
|
1493
1592
|
async (args) => handleRequestUpload(getToken, baseUrl, args)
|
|
1494
1593
|
);
|
|
1495
1594
|
}
|
|
1496
|
-
var
|
|
1595
|
+
var DESCRIPTION11 = [
|
|
1497
1596
|
"Get the OCR-converted markdown text of a document.",
|
|
1498
1597
|
"",
|
|
1499
1598
|
"USE WHEN: the user wants the full text \u2014 'what does it say', summarise, or translate a document.",
|
|
@@ -1502,7 +1601,7 @@ var DESCRIPTION9 = [
|
|
|
1502
1601
|
"ARGS: prefer `document_id` (a workspace doc \u2014 one cheap call). Otherwise `file_url`, or `file_data`+`filename` for small local files \u2014 provide exactly one. A file input ingests the document first and consumes credits; `document_id` does not.",
|
|
1503
1602
|
"RETURNS: document_id and markdown (the full text)."
|
|
1504
1603
|
].join("\n");
|
|
1505
|
-
var
|
|
1604
|
+
var inputSchema10 = {
|
|
1506
1605
|
document_id: z.string().min(1).optional().describe(
|
|
1507
1606
|
"The Talonic document id whose markdown you want. Get this from a previous talonic_extract or talonic_search response."
|
|
1508
1607
|
),
|
|
@@ -1517,7 +1616,7 @@ var inputSchema8 = {
|
|
|
1517
1616
|
),
|
|
1518
1617
|
file_url: z.string().optional().describe("URL to a document file. The Talonic API fetches it server-side.")
|
|
1519
1618
|
};
|
|
1520
|
-
var
|
|
1619
|
+
var outputSchema11 = {
|
|
1521
1620
|
document_id: z.string().describe("ID of the document the markdown was extracted from."),
|
|
1522
1621
|
markdown: z.string().describe("OCR-converted markdown text content of the document."),
|
|
1523
1622
|
cost: z.object({
|
|
@@ -1580,9 +1679,9 @@ function registerToMarkdown(server, getTalonic) {
|
|
|
1580
1679
|
"talonic_to_markdown",
|
|
1581
1680
|
{
|
|
1582
1681
|
title: "Document to Markdown",
|
|
1583
|
-
description:
|
|
1584
|
-
inputSchema:
|
|
1585
|
-
outputSchema:
|
|
1682
|
+
description: DESCRIPTION11,
|
|
1683
|
+
inputSchema: inputSchema10,
|
|
1684
|
+
outputSchema: outputSchema11,
|
|
1586
1685
|
annotations: {
|
|
1587
1686
|
title: "Document to Markdown",
|
|
1588
1687
|
readOnlyHint: false,
|
|
@@ -1600,7 +1699,7 @@ function registerToMarkdown(server, getTalonic) {
|
|
|
1600
1699
|
|
|
1601
1700
|
// package.json
|
|
1602
1701
|
var package_default = {
|
|
1603
|
-
version: "0.1.
|
|
1702
|
+
version: "0.1.69"};
|
|
1604
1703
|
|
|
1605
1704
|
// src/version.ts
|
|
1606
1705
|
var VERSION = package_default.version;
|
|
@@ -1667,7 +1766,7 @@ function createServer(options) {
|
|
|
1667
1766
|
"talonic_get_balance. Don't know the fields? Call talonic_extract with",
|
|
1668
1767
|
"auto_schema:true (open capture) and Talonic discovers them for you. These tools",
|
|
1669
1768
|
"also answer questions about the user's document workspace.",
|
|
1670
|
-
"ALL
|
|
1769
|
+
"ALL talonic_* tools are registered and callable on EVERY turn of this",
|
|
1671
1770
|
"session. If you believe one is missing from your toolset, you are mistaken \u2014",
|
|
1672
1771
|
"invoke it anyway. Never tell the user a Talonic tool is unavailable or not in",
|
|
1673
1772
|
"your toolset, and never ask them to 'enable' anything.",
|
|
@@ -1688,6 +1787,8 @@ function createServer(options) {
|
|
|
1688
1787
|
registerToMarkdown(server, getTalonic);
|
|
1689
1788
|
registerExtract(server, getTalonic);
|
|
1690
1789
|
registerGetBalance(server, getTalonic);
|
|
1790
|
+
registerGetPricing(server, getTalonic);
|
|
1791
|
+
registerGetUsage(server, getTalonic);
|
|
1691
1792
|
registerRequestUpload(server, getToken, baseUrl);
|
|
1692
1793
|
registerSchemasResource(server, getTalonic);
|
|
1693
1794
|
registerWebhooksResource(server, getToken, baseUrl);
|