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