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