@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/http-server.js
CHANGED
|
@@ -1104,6 +1104,105 @@ function registerGetBalance(server, getTalonic) {
|
|
|
1104
1104
|
);
|
|
1105
1105
|
}
|
|
1106
1106
|
var DESCRIPTION4 = [
|
|
1107
|
+
"Read Talonic's machine-readable credit pricing catalog: fixed per-unit rates so you can predict spend BEFORE running anything.",
|
|
1108
|
+
"",
|
|
1109
|
+
"USE WHEN: estimating the cost of a planned extraction/structuring/matching job, or answering a pricing question. Public \u2014 works without spending credits.",
|
|
1110
|
+
"NOT FOR: the workspace's current balance (use talonic_get_balance) or what it has already spent (use talonic_get_usage).",
|
|
1111
|
+
"ARGS: none.",
|
|
1112
|
+
"RETURNS: currency, credits_per_eur, multipliers (e.g. batch 0.5x), and units[] \u2014 each { unit, label, credits, eur, free }."
|
|
1113
|
+
].join("\n");
|
|
1114
|
+
var inputSchema4 = {};
|
|
1115
|
+
var outputSchema4 = {
|
|
1116
|
+
currency: z.string().describe("Billing currency (always EUR)."),
|
|
1117
|
+
credits_per_eur: z.number().describe("Credits per EUR (e.g. 1000 = \u20AC1)."),
|
|
1118
|
+
multipliers: z.record(z.string(), z.number()).describe(
|
|
1119
|
+
"Processing-mode multipliers applied on top of per-unit cost (e.g. { realtime: 1, batch: 0.5 })."
|
|
1120
|
+
),
|
|
1121
|
+
units: z.array(
|
|
1122
|
+
z.object({
|
|
1123
|
+
unit: z.string().describe("Billable unit identifier."),
|
|
1124
|
+
label: z.string().describe("Human-readable label."),
|
|
1125
|
+
credits: z.number().describe("Credits per unit (0 = free)."),
|
|
1126
|
+
eur: z.number().describe("EUR per unit."),
|
|
1127
|
+
free: z.boolean().describe("Whether the unit is free.")
|
|
1128
|
+
})
|
|
1129
|
+
).describe("The per-unit pricing catalog.")
|
|
1130
|
+
};
|
|
1131
|
+
async function handleGetPricing(talonic) {
|
|
1132
|
+
try {
|
|
1133
|
+
const result = await talonic.pricing.get();
|
|
1134
|
+
return jsonOk(result);
|
|
1135
|
+
} catch (err) {
|
|
1136
|
+
return toolError(err);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
function registerGetPricing(server, getTalonic) {
|
|
1140
|
+
server.registerTool(
|
|
1141
|
+
"talonic_get_pricing",
|
|
1142
|
+
{
|
|
1143
|
+
title: "Get Talonic Pricing",
|
|
1144
|
+
description: DESCRIPTION4,
|
|
1145
|
+
inputSchema: inputSchema4,
|
|
1146
|
+
outputSchema: outputSchema4,
|
|
1147
|
+
annotations: {
|
|
1148
|
+
title: "Get Talonic Pricing",
|
|
1149
|
+
readOnlyHint: true,
|
|
1150
|
+
destructiveHint: false,
|
|
1151
|
+
openWorldHint: false
|
|
1152
|
+
}
|
|
1153
|
+
},
|
|
1154
|
+
async () => handleGetPricing(getTalonic())
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
var DESCRIPTION5 = [
|
|
1158
|
+
"Read the workspace's per-function credit consumption over a trailing window: where the credits actually went.",
|
|
1159
|
+
"",
|
|
1160
|
+
"USE WHEN: the user asks what they have spent credits on, or you want to see which function (extraction, structuring, intelligence ops) dominates spend.",
|
|
1161
|
+
"NOT FOR: the remaining balance (use talonic_get_balance) or per-unit rates (use talonic_get_pricing).",
|
|
1162
|
+
"ARGS: days (optional, default 30, clamped 1-365).",
|
|
1163
|
+
"RETURNS: period_days, total_credits, and by_function[] \u2014 each { operation_type, operations, credits }, highest spend first."
|
|
1164
|
+
].join("\n");
|
|
1165
|
+
var inputSchema5 = {
|
|
1166
|
+
days: z.number().int().min(1).max(365).optional().describe("Trailing window in days (default 30).")
|
|
1167
|
+
};
|
|
1168
|
+
var outputSchema5 = {
|
|
1169
|
+
period_days: z.number().describe("Length of the reporting window in days."),
|
|
1170
|
+
total_credits: z.number().describe("Total credits consumed across all functions in the window."),
|
|
1171
|
+
by_function: z.array(
|
|
1172
|
+
z.object({
|
|
1173
|
+
operation_type: z.string().describe("Platform function / billable operation type."),
|
|
1174
|
+
operations: z.number().describe("Number of charged operations of this type."),
|
|
1175
|
+
credits: z.number().describe("Total credits consumed by this function.")
|
|
1176
|
+
})
|
|
1177
|
+
).describe("Per-function breakdown, highest spend first.")
|
|
1178
|
+
};
|
|
1179
|
+
async function handleGetUsage(talonic, days) {
|
|
1180
|
+
try {
|
|
1181
|
+
const result = await talonic.usage.getByFunction(days);
|
|
1182
|
+
return jsonOk(result);
|
|
1183
|
+
} catch (err) {
|
|
1184
|
+
return toolError(err);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
function registerGetUsage(server, getTalonic) {
|
|
1188
|
+
server.registerTool(
|
|
1189
|
+
"talonic_get_usage",
|
|
1190
|
+
{
|
|
1191
|
+
title: "Get Talonic Usage",
|
|
1192
|
+
description: DESCRIPTION5,
|
|
1193
|
+
inputSchema: inputSchema5,
|
|
1194
|
+
outputSchema: outputSchema5,
|
|
1195
|
+
annotations: {
|
|
1196
|
+
title: "Get Talonic Usage",
|
|
1197
|
+
readOnlyHint: true,
|
|
1198
|
+
destructiveHint: false,
|
|
1199
|
+
openWorldHint: false
|
|
1200
|
+
}
|
|
1201
|
+
},
|
|
1202
|
+
async (args) => handleGetUsage(getTalonic(), args.days)
|
|
1203
|
+
);
|
|
1204
|
+
}
|
|
1205
|
+
var DESCRIPTION6 = [
|
|
1107
1206
|
"Fetch a single document's metadata and processing status from the workspace.",
|
|
1108
1207
|
"",
|
|
1109
1208
|
"USE WHEN: 'tell me about document X', or to poll status after talonic_request_upload until the file is ready.",
|
|
@@ -1112,12 +1211,12 @@ var DESCRIPTION4 = [
|
|
|
1112
1211
|
"ARGS: document_id.",
|
|
1113
1212
|
"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."
|
|
1114
1213
|
].join("\n");
|
|
1115
|
-
var
|
|
1214
|
+
var inputSchema6 = {
|
|
1116
1215
|
document_id: z.string().min(1).describe(
|
|
1117
1216
|
"The Talonic document ID. Get this from a previous talonic_extract or talonic_search response."
|
|
1118
1217
|
)
|
|
1119
1218
|
};
|
|
1120
|
-
var
|
|
1219
|
+
var outputSchema6 = {
|
|
1121
1220
|
id: z.string(),
|
|
1122
1221
|
// Freshly-uploaded / pre-extraction documents (browser-handoff polling) return
|
|
1123
1222
|
// null for these until OCR/ingest computes them. They MUST accept null, or the
|
|
@@ -1180,9 +1279,9 @@ function registerGetDocument(server, getTalonic) {
|
|
|
1180
1279
|
"talonic_get_document",
|
|
1181
1280
|
{
|
|
1182
1281
|
title: "Get Talonic Document",
|
|
1183
|
-
description:
|
|
1184
|
-
inputSchema:
|
|
1185
|
-
outputSchema:
|
|
1282
|
+
description: DESCRIPTION6,
|
|
1283
|
+
inputSchema: inputSchema6,
|
|
1284
|
+
outputSchema: outputSchema6,
|
|
1186
1285
|
annotations: {
|
|
1187
1286
|
title: "Get Talonic Document",
|
|
1188
1287
|
readOnlyHint: true,
|
|
@@ -1197,7 +1296,7 @@ function registerGetDocument(server, getTalonic) {
|
|
|
1197
1296
|
async (args) => handleGetDocument(getTalonic(), args)
|
|
1198
1297
|
);
|
|
1199
1298
|
}
|
|
1200
|
-
var
|
|
1299
|
+
var DESCRIPTION7 = [
|
|
1201
1300
|
"List the saved schemas in the workspace as compact summaries (id, short_id, name, description, version, field_count).",
|
|
1202
1301
|
"",
|
|
1203
1302
|
"USE WHEN: 'what schemas do I have', or to find a reusable schema before extracting.",
|
|
@@ -1223,7 +1322,7 @@ var schemaItem = z.object({
|
|
|
1223
1322
|
dashboard: z.string().optional()
|
|
1224
1323
|
}).optional()
|
|
1225
1324
|
});
|
|
1226
|
-
var
|
|
1325
|
+
var outputSchema7 = {
|
|
1227
1326
|
data: z.array(schemaItem).describe("Saved schemas in the workspace."),
|
|
1228
1327
|
pagination: z.object({
|
|
1229
1328
|
total: z.number().optional(),
|
|
@@ -1253,9 +1352,9 @@ function registerListSchemas(server, getTalonic) {
|
|
|
1253
1352
|
"talonic_list_schemas",
|
|
1254
1353
|
{
|
|
1255
1354
|
title: "List Talonic Schemas",
|
|
1256
|
-
description:
|
|
1355
|
+
description: DESCRIPTION7,
|
|
1257
1356
|
inputSchema: {},
|
|
1258
|
-
outputSchema:
|
|
1357
|
+
outputSchema: outputSchema7,
|
|
1259
1358
|
annotations: {
|
|
1260
1359
|
title: "List Talonic Schemas",
|
|
1261
1360
|
readOnlyHint: true,
|
|
@@ -1270,7 +1369,7 @@ function registerListSchemas(server, getTalonic) {
|
|
|
1270
1369
|
async () => handleListSchemas(getTalonic())
|
|
1271
1370
|
);
|
|
1272
1371
|
}
|
|
1273
|
-
var
|
|
1372
|
+
var DESCRIPTION8 = [
|
|
1274
1373
|
"Save a reusable schema to the workspace for use across future extractions.",
|
|
1275
1374
|
"",
|
|
1276
1375
|
"USE WHEN: the user confirms a schema/template they want to reuse across documents.",
|
|
@@ -1278,14 +1377,14 @@ var DESCRIPTION6 = [
|
|
|
1278
1377
|
"ARGS: `name`; `definition` \u2014 a JSON Schema ({type:'object',properties:{...}}) or a flat {field:'type'} map.",
|
|
1279
1378
|
"RETURNS: the saved schema with id and short_id. Pass either to talonic_extract as `schema_id`."
|
|
1280
1379
|
].join("\n");
|
|
1281
|
-
var
|
|
1380
|
+
var inputSchema7 = {
|
|
1282
1381
|
name: z.string().min(1).describe("Human-readable name for the schema, e.g. 'Standard Invoice'."),
|
|
1283
1382
|
definition: z.record(z.string(), z.unknown()).describe(
|
|
1284
1383
|
"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."
|
|
1285
1384
|
),
|
|
1286
1385
|
description: z.string().optional().describe("Optional description of what this schema extracts and when to use it.")
|
|
1287
1386
|
};
|
|
1288
|
-
var
|
|
1387
|
+
var outputSchema8 = {
|
|
1289
1388
|
id: z.string().describe("UUID of the newly saved schema."),
|
|
1290
1389
|
short_id: z.string().optional().describe("Human-readable short id (SCH-XXXXXXXX)."),
|
|
1291
1390
|
name: z.string(),
|
|
@@ -1320,9 +1419,9 @@ function registerSaveSchema(server, getTalonic) {
|
|
|
1320
1419
|
"talonic_save_schema",
|
|
1321
1420
|
{
|
|
1322
1421
|
title: "Save Talonic Schema",
|
|
1323
|
-
description:
|
|
1324
|
-
inputSchema:
|
|
1325
|
-
outputSchema:
|
|
1422
|
+
description: DESCRIPTION8,
|
|
1423
|
+
inputSchema: inputSchema7,
|
|
1424
|
+
outputSchema: outputSchema8,
|
|
1326
1425
|
annotations: {
|
|
1327
1426
|
title: "Save Talonic Schema",
|
|
1328
1427
|
readOnlyHint: false,
|
|
@@ -1337,7 +1436,7 @@ function registerSaveSchema(server, getTalonic) {
|
|
|
1337
1436
|
async (args) => handleSaveSchema(getTalonic(), args)
|
|
1338
1437
|
);
|
|
1339
1438
|
}
|
|
1340
|
-
var
|
|
1439
|
+
var DESCRIPTION9 = [
|
|
1341
1440
|
"Find documents, fields, schemas, or sources in the workspace. One call returns ranked results across all types.",
|
|
1342
1441
|
"",
|
|
1343
1442
|
"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.",
|
|
@@ -1346,13 +1445,13 @@ var DESCRIPTION7 = [
|
|
|
1346
1445
|
"ARGS: query (short literal keyword); optional limit.",
|
|
1347
1446
|
"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."
|
|
1348
1447
|
].join("\n");
|
|
1349
|
-
var
|
|
1448
|
+
var inputSchema8 = {
|
|
1350
1449
|
query: z.string().min(1).describe(
|
|
1351
1450
|
"ONE short, SINGULAR keyword or an exact filename \u2014 'invoice', 'insurance certificate', 'sample-invoice.pdf'. Matching is literal: sentences and plurals return empty."
|
|
1352
1451
|
),
|
|
1353
1452
|
limit: z.number().int().positive().optional().describe("Maximum results per entity type. Default: 5. Increase for broader exploration.")
|
|
1354
1453
|
};
|
|
1355
|
-
var
|
|
1454
|
+
var outputSchema9 = {
|
|
1356
1455
|
documents: z.array(
|
|
1357
1456
|
z.object({
|
|
1358
1457
|
id: z.string(),
|
|
@@ -1421,9 +1520,9 @@ function registerSearch(server, getTalonic) {
|
|
|
1421
1520
|
"talonic_search",
|
|
1422
1521
|
{
|
|
1423
1522
|
title: "Search Talonic Workspace",
|
|
1424
|
-
description:
|
|
1425
|
-
inputSchema:
|
|
1426
|
-
outputSchema:
|
|
1523
|
+
description: DESCRIPTION9,
|
|
1524
|
+
inputSchema: inputSchema8,
|
|
1525
|
+
outputSchema: outputSchema9,
|
|
1427
1526
|
annotations: {
|
|
1428
1527
|
title: "Search Talonic Workspace",
|
|
1429
1528
|
readOnlyHint: true,
|
|
@@ -1438,7 +1537,7 @@ function registerSearch(server, getTalonic) {
|
|
|
1438
1537
|
async (args) => handleSearch(getTalonic(), args)
|
|
1439
1538
|
);
|
|
1440
1539
|
}
|
|
1441
|
-
var
|
|
1540
|
+
var DESCRIPTION10 = [
|
|
1442
1541
|
"Get a browser upload link the user opens to add a file to their workspace. Returns the link plus a pre-allocated document_id.",
|
|
1443
1542
|
"",
|
|
1444
1543
|
"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.",
|
|
@@ -1446,12 +1545,12 @@ var DESCRIPTION8 = [
|
|
|
1446
1545
|
"ARGS: filename (with extension).",
|
|
1447
1546
|
"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."
|
|
1448
1547
|
].join("\n");
|
|
1449
|
-
var
|
|
1548
|
+
var inputSchema9 = {
|
|
1450
1549
|
filename: z.string().min(1).describe(
|
|
1451
1550
|
"The name of the file being uploaded, including extension (e.g. 'invoice.pdf'). Used to pre-allocate the document and infer MIME type."
|
|
1452
1551
|
)
|
|
1453
1552
|
};
|
|
1454
|
-
var
|
|
1553
|
+
var outputSchema10 = {
|
|
1455
1554
|
document_id: z.string().describe(
|
|
1456
1555
|
"The pre-allocated document ID. Use with talonic_get_document to poll status, and with talonic_extract once uploaded."
|
|
1457
1556
|
),
|
|
@@ -1492,9 +1591,9 @@ function registerRequestUpload(server, getToken, baseUrl) {
|
|
|
1492
1591
|
"talonic_request_upload",
|
|
1493
1592
|
{
|
|
1494
1593
|
title: "Request File Upload",
|
|
1495
|
-
description:
|
|
1496
|
-
inputSchema:
|
|
1497
|
-
outputSchema:
|
|
1594
|
+
description: DESCRIPTION10,
|
|
1595
|
+
inputSchema: inputSchema9,
|
|
1596
|
+
outputSchema: outputSchema10,
|
|
1498
1597
|
annotations: {
|
|
1499
1598
|
title: "Request File Upload",
|
|
1500
1599
|
readOnlyHint: false,
|
|
@@ -1509,7 +1608,7 @@ function registerRequestUpload(server, getToken, baseUrl) {
|
|
|
1509
1608
|
async (args) => handleRequestUpload(getToken, baseUrl, args)
|
|
1510
1609
|
);
|
|
1511
1610
|
}
|
|
1512
|
-
var
|
|
1611
|
+
var DESCRIPTION11 = [
|
|
1513
1612
|
"Get the OCR-converted markdown text of a document.",
|
|
1514
1613
|
"",
|
|
1515
1614
|
"USE WHEN: the user wants the full text \u2014 'what does it say', summarise, or translate a document.",
|
|
@@ -1518,7 +1617,7 @@ var DESCRIPTION9 = [
|
|
|
1518
1617
|
"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.",
|
|
1519
1618
|
"RETURNS: document_id and markdown (the full text)."
|
|
1520
1619
|
].join("\n");
|
|
1521
|
-
var
|
|
1620
|
+
var inputSchema10 = {
|
|
1522
1621
|
document_id: z.string().min(1).optional().describe(
|
|
1523
1622
|
"The Talonic document id whose markdown you want. Get this from a previous talonic_extract or talonic_search response."
|
|
1524
1623
|
),
|
|
@@ -1533,7 +1632,7 @@ var inputSchema8 = {
|
|
|
1533
1632
|
),
|
|
1534
1633
|
file_url: z.string().optional().describe("URL to a document file. The Talonic API fetches it server-side.")
|
|
1535
1634
|
};
|
|
1536
|
-
var
|
|
1635
|
+
var outputSchema11 = {
|
|
1537
1636
|
document_id: z.string().describe("ID of the document the markdown was extracted from."),
|
|
1538
1637
|
markdown: z.string().describe("OCR-converted markdown text content of the document."),
|
|
1539
1638
|
cost: z.object({
|
|
@@ -1596,9 +1695,9 @@ function registerToMarkdown(server, getTalonic) {
|
|
|
1596
1695
|
"talonic_to_markdown",
|
|
1597
1696
|
{
|
|
1598
1697
|
title: "Document to Markdown",
|
|
1599
|
-
description:
|
|
1600
|
-
inputSchema:
|
|
1601
|
-
outputSchema:
|
|
1698
|
+
description: DESCRIPTION11,
|
|
1699
|
+
inputSchema: inputSchema10,
|
|
1700
|
+
outputSchema: outputSchema11,
|
|
1602
1701
|
annotations: {
|
|
1603
1702
|
title: "Document to Markdown",
|
|
1604
1703
|
readOnlyHint: false,
|
|
@@ -1616,7 +1715,7 @@ function registerToMarkdown(server, getTalonic) {
|
|
|
1616
1715
|
|
|
1617
1716
|
// package.json
|
|
1618
1717
|
var package_default = {
|
|
1619
|
-
version: "0.1.
|
|
1718
|
+
version: "0.1.69"};
|
|
1620
1719
|
|
|
1621
1720
|
// src/version.ts
|
|
1622
1721
|
var VERSION = package_default.version;
|
|
@@ -1683,7 +1782,7 @@ function createServer(options) {
|
|
|
1683
1782
|
"talonic_get_balance. Don't know the fields? Call talonic_extract with",
|
|
1684
1783
|
"auto_schema:true (open capture) and Talonic discovers them for you. These tools",
|
|
1685
1784
|
"also answer questions about the user's document workspace.",
|
|
1686
|
-
"ALL
|
|
1785
|
+
"ALL talonic_* tools are registered and callable on EVERY turn of this",
|
|
1687
1786
|
"session. If you believe one is missing from your toolset, you are mistaken \u2014",
|
|
1688
1787
|
"invoke it anyway. Never tell the user a Talonic tool is unavailable or not in",
|
|
1689
1788
|
"your toolset, and never ask them to 'enable' anything.",
|
|
@@ -1704,6 +1803,8 @@ function createServer(options) {
|
|
|
1704
1803
|
registerToMarkdown(server, getTalonic);
|
|
1705
1804
|
registerExtract(server, getTalonic);
|
|
1706
1805
|
registerGetBalance(server, getTalonic);
|
|
1806
|
+
registerGetPricing(server, getTalonic);
|
|
1807
|
+
registerGetUsage(server, getTalonic);
|
|
1707
1808
|
registerRequestUpload(server, getToken, baseUrl);
|
|
1708
1809
|
registerSchemasResource(server, getTalonic);
|
|
1709
1810
|
registerWebhooksResource(server, getToken, baseUrl);
|