@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/index.js
CHANGED
|
@@ -1086,6 +1086,105 @@ function registerGetBalance(server, getTalonic) {
|
|
|
1086
1086
|
);
|
|
1087
1087
|
}
|
|
1088
1088
|
var DESCRIPTION4 = [
|
|
1089
|
+
"Read Talonic's machine-readable credit pricing catalog: fixed per-unit rates so you can predict spend BEFORE running anything.",
|
|
1090
|
+
"",
|
|
1091
|
+
"USE WHEN: estimating the cost of a planned extraction/structuring/matching job, or answering a pricing question. Public \u2014 works without spending credits.",
|
|
1092
|
+
"NOT FOR: the workspace's current balance (use talonic_get_balance) or what it has already spent (use talonic_get_usage).",
|
|
1093
|
+
"ARGS: none.",
|
|
1094
|
+
"RETURNS: currency, credits_per_eur, multipliers (e.g. batch 0.5x), and units[] \u2014 each { unit, label, credits, eur, free }."
|
|
1095
|
+
].join("\n");
|
|
1096
|
+
var inputSchema4 = {};
|
|
1097
|
+
var outputSchema4 = {
|
|
1098
|
+
currency: z.string().describe("Billing currency (always EUR)."),
|
|
1099
|
+
credits_per_eur: z.number().describe("Credits per EUR (e.g. 1000 = \u20AC1)."),
|
|
1100
|
+
multipliers: z.record(z.string(), z.number()).describe(
|
|
1101
|
+
"Processing-mode multipliers applied on top of per-unit cost (e.g. { realtime: 1, batch: 0.5 })."
|
|
1102
|
+
),
|
|
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 = [
|
|
1089
1188
|
"Fetch a single document's metadata and processing status from the workspace.",
|
|
1090
1189
|
"",
|
|
1091
1190
|
"USE WHEN: 'tell me about document X', or to poll status after talonic_request_upload until the file is ready.",
|
|
@@ -1094,12 +1193,12 @@ var DESCRIPTION4 = [
|
|
|
1094
1193
|
"ARGS: document_id.",
|
|
1095
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."
|
|
1096
1195
|
].join("\n");
|
|
1097
|
-
var
|
|
1196
|
+
var inputSchema6 = {
|
|
1098
1197
|
document_id: z.string().min(1).describe(
|
|
1099
1198
|
"The Talonic document ID. Get this from a previous talonic_extract or talonic_search response."
|
|
1100
1199
|
)
|
|
1101
1200
|
};
|
|
1102
|
-
var
|
|
1201
|
+
var outputSchema6 = {
|
|
1103
1202
|
id: z.string(),
|
|
1104
1203
|
// Freshly-uploaded / pre-extraction documents (browser-handoff polling) return
|
|
1105
1204
|
// null for these until OCR/ingest computes them. They MUST accept null, or the
|
|
@@ -1162,9 +1261,9 @@ function registerGetDocument(server, getTalonic) {
|
|
|
1162
1261
|
"talonic_get_document",
|
|
1163
1262
|
{
|
|
1164
1263
|
title: "Get Talonic Document",
|
|
1165
|
-
description:
|
|
1166
|
-
inputSchema:
|
|
1167
|
-
outputSchema:
|
|
1264
|
+
description: DESCRIPTION6,
|
|
1265
|
+
inputSchema: inputSchema6,
|
|
1266
|
+
outputSchema: outputSchema6,
|
|
1168
1267
|
annotations: {
|
|
1169
1268
|
title: "Get Talonic Document",
|
|
1170
1269
|
readOnlyHint: true,
|
|
@@ -1179,7 +1278,7 @@ function registerGetDocument(server, getTalonic) {
|
|
|
1179
1278
|
async (args) => handleGetDocument(getTalonic(), args)
|
|
1180
1279
|
);
|
|
1181
1280
|
}
|
|
1182
|
-
var
|
|
1281
|
+
var DESCRIPTION7 = [
|
|
1183
1282
|
"List the saved schemas in the workspace as compact summaries (id, short_id, name, description, version, field_count).",
|
|
1184
1283
|
"",
|
|
1185
1284
|
"USE WHEN: 'what schemas do I have', or to find a reusable schema before extracting.",
|
|
@@ -1205,7 +1304,7 @@ var schemaItem = z.object({
|
|
|
1205
1304
|
dashboard: z.string().optional()
|
|
1206
1305
|
}).optional()
|
|
1207
1306
|
});
|
|
1208
|
-
var
|
|
1307
|
+
var outputSchema7 = {
|
|
1209
1308
|
data: z.array(schemaItem).describe("Saved schemas in the workspace."),
|
|
1210
1309
|
pagination: z.object({
|
|
1211
1310
|
total: z.number().optional(),
|
|
@@ -1235,9 +1334,9 @@ function registerListSchemas(server, getTalonic) {
|
|
|
1235
1334
|
"talonic_list_schemas",
|
|
1236
1335
|
{
|
|
1237
1336
|
title: "List Talonic Schemas",
|
|
1238
|
-
description:
|
|
1337
|
+
description: DESCRIPTION7,
|
|
1239
1338
|
inputSchema: {},
|
|
1240
|
-
outputSchema:
|
|
1339
|
+
outputSchema: outputSchema7,
|
|
1241
1340
|
annotations: {
|
|
1242
1341
|
title: "List Talonic Schemas",
|
|
1243
1342
|
readOnlyHint: true,
|
|
@@ -1252,7 +1351,7 @@ function registerListSchemas(server, getTalonic) {
|
|
|
1252
1351
|
async () => handleListSchemas(getTalonic())
|
|
1253
1352
|
);
|
|
1254
1353
|
}
|
|
1255
|
-
var
|
|
1354
|
+
var DESCRIPTION8 = [
|
|
1256
1355
|
"Save a reusable schema to the workspace for use across future extractions.",
|
|
1257
1356
|
"",
|
|
1258
1357
|
"USE WHEN: the user confirms a schema/template they want to reuse across documents.",
|
|
@@ -1260,14 +1359,14 @@ var DESCRIPTION6 = [
|
|
|
1260
1359
|
"ARGS: `name`; `definition` \u2014 a JSON Schema ({type:'object',properties:{...}}) or a flat {field:'type'} map.",
|
|
1261
1360
|
"RETURNS: the saved schema with id and short_id. Pass either to talonic_extract as `schema_id`."
|
|
1262
1361
|
].join("\n");
|
|
1263
|
-
var
|
|
1362
|
+
var inputSchema7 = {
|
|
1264
1363
|
name: z.string().min(1).describe("Human-readable name for the schema, e.g. 'Standard Invoice'."),
|
|
1265
1364
|
definition: z.record(z.string(), z.unknown()).describe(
|
|
1266
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."
|
|
1267
1366
|
),
|
|
1268
1367
|
description: z.string().optional().describe("Optional description of what this schema extracts and when to use it.")
|
|
1269
1368
|
};
|
|
1270
|
-
var
|
|
1369
|
+
var outputSchema8 = {
|
|
1271
1370
|
id: z.string().describe("UUID of the newly saved schema."),
|
|
1272
1371
|
short_id: z.string().optional().describe("Human-readable short id (SCH-XXXXXXXX)."),
|
|
1273
1372
|
name: z.string(),
|
|
@@ -1302,9 +1401,9 @@ function registerSaveSchema(server, getTalonic) {
|
|
|
1302
1401
|
"talonic_save_schema",
|
|
1303
1402
|
{
|
|
1304
1403
|
title: "Save Talonic Schema",
|
|
1305
|
-
description:
|
|
1306
|
-
inputSchema:
|
|
1307
|
-
outputSchema:
|
|
1404
|
+
description: DESCRIPTION8,
|
|
1405
|
+
inputSchema: inputSchema7,
|
|
1406
|
+
outputSchema: outputSchema8,
|
|
1308
1407
|
annotations: {
|
|
1309
1408
|
title: "Save Talonic Schema",
|
|
1310
1409
|
readOnlyHint: false,
|
|
@@ -1319,7 +1418,7 @@ function registerSaveSchema(server, getTalonic) {
|
|
|
1319
1418
|
async (args) => handleSaveSchema(getTalonic(), args)
|
|
1320
1419
|
);
|
|
1321
1420
|
}
|
|
1322
|
-
var
|
|
1421
|
+
var DESCRIPTION9 = [
|
|
1323
1422
|
"Find documents, fields, schemas, or sources in the workspace. One call returns ranked results across all types.",
|
|
1324
1423
|
"",
|
|
1325
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.",
|
|
@@ -1328,13 +1427,13 @@ var DESCRIPTION7 = [
|
|
|
1328
1427
|
"ARGS: query (short literal keyword); optional limit.",
|
|
1329
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."
|
|
1330
1429
|
].join("\n");
|
|
1331
|
-
var
|
|
1430
|
+
var inputSchema8 = {
|
|
1332
1431
|
query: z.string().min(1).describe(
|
|
1333
1432
|
"ONE short, SINGULAR keyword or an exact filename \u2014 'invoice', 'insurance certificate', 'sample-invoice.pdf'. Matching is literal: sentences and plurals return empty."
|
|
1334
1433
|
),
|
|
1335
1434
|
limit: z.number().int().positive().optional().describe("Maximum results per entity type. Default: 5. Increase for broader exploration.")
|
|
1336
1435
|
};
|
|
1337
|
-
var
|
|
1436
|
+
var outputSchema9 = {
|
|
1338
1437
|
documents: z.array(
|
|
1339
1438
|
z.object({
|
|
1340
1439
|
id: z.string(),
|
|
@@ -1403,9 +1502,9 @@ function registerSearch(server, getTalonic) {
|
|
|
1403
1502
|
"talonic_search",
|
|
1404
1503
|
{
|
|
1405
1504
|
title: "Search Talonic Workspace",
|
|
1406
|
-
description:
|
|
1407
|
-
inputSchema:
|
|
1408
|
-
outputSchema:
|
|
1505
|
+
description: DESCRIPTION9,
|
|
1506
|
+
inputSchema: inputSchema8,
|
|
1507
|
+
outputSchema: outputSchema9,
|
|
1409
1508
|
annotations: {
|
|
1410
1509
|
title: "Search Talonic Workspace",
|
|
1411
1510
|
readOnlyHint: true,
|
|
@@ -1420,7 +1519,7 @@ function registerSearch(server, getTalonic) {
|
|
|
1420
1519
|
async (args) => handleSearch(getTalonic(), args)
|
|
1421
1520
|
);
|
|
1422
1521
|
}
|
|
1423
|
-
var
|
|
1522
|
+
var DESCRIPTION10 = [
|
|
1424
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.",
|
|
1425
1524
|
"",
|
|
1426
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.",
|
|
@@ -1428,12 +1527,12 @@ var DESCRIPTION8 = [
|
|
|
1428
1527
|
"ARGS: filename (with extension).",
|
|
1429
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."
|
|
1430
1529
|
].join("\n");
|
|
1431
|
-
var
|
|
1530
|
+
var inputSchema9 = {
|
|
1432
1531
|
filename: z.string().min(1).describe(
|
|
1433
1532
|
"The name of the file being uploaded, including extension (e.g. 'invoice.pdf'). Used to pre-allocate the document and infer MIME type."
|
|
1434
1533
|
)
|
|
1435
1534
|
};
|
|
1436
|
-
var
|
|
1535
|
+
var outputSchema10 = {
|
|
1437
1536
|
document_id: z.string().describe(
|
|
1438
1537
|
"The pre-allocated document ID. Use with talonic_get_document to poll status, and with talonic_extract once uploaded."
|
|
1439
1538
|
),
|
|
@@ -1474,9 +1573,9 @@ function registerRequestUpload(server, getToken, baseUrl) {
|
|
|
1474
1573
|
"talonic_request_upload",
|
|
1475
1574
|
{
|
|
1476
1575
|
title: "Request File Upload",
|
|
1477
|
-
description:
|
|
1478
|
-
inputSchema:
|
|
1479
|
-
outputSchema:
|
|
1576
|
+
description: DESCRIPTION10,
|
|
1577
|
+
inputSchema: inputSchema9,
|
|
1578
|
+
outputSchema: outputSchema10,
|
|
1480
1579
|
annotations: {
|
|
1481
1580
|
title: "Request File Upload",
|
|
1482
1581
|
readOnlyHint: false,
|
|
@@ -1491,7 +1590,7 @@ function registerRequestUpload(server, getToken, baseUrl) {
|
|
|
1491
1590
|
async (args) => handleRequestUpload(getToken, baseUrl, args)
|
|
1492
1591
|
);
|
|
1493
1592
|
}
|
|
1494
|
-
var
|
|
1593
|
+
var DESCRIPTION11 = [
|
|
1495
1594
|
"Get the OCR-converted markdown text of a document.",
|
|
1496
1595
|
"",
|
|
1497
1596
|
"USE WHEN: the user wants the full text \u2014 'what does it say', summarise, or translate a document.",
|
|
@@ -1500,7 +1599,7 @@ var DESCRIPTION9 = [
|
|
|
1500
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.",
|
|
1501
1600
|
"RETURNS: document_id and markdown (the full text)."
|
|
1502
1601
|
].join("\n");
|
|
1503
|
-
var
|
|
1602
|
+
var inputSchema10 = {
|
|
1504
1603
|
document_id: z.string().min(1).optional().describe(
|
|
1505
1604
|
"The Talonic document id whose markdown you want. Get this from a previous talonic_extract or talonic_search response."
|
|
1506
1605
|
),
|
|
@@ -1515,7 +1614,7 @@ var inputSchema8 = {
|
|
|
1515
1614
|
),
|
|
1516
1615
|
file_url: z.string().optional().describe("URL to a document file. The Talonic API fetches it server-side.")
|
|
1517
1616
|
};
|
|
1518
|
-
var
|
|
1617
|
+
var outputSchema11 = {
|
|
1519
1618
|
document_id: z.string().describe("ID of the document the markdown was extracted from."),
|
|
1520
1619
|
markdown: z.string().describe("OCR-converted markdown text content of the document."),
|
|
1521
1620
|
cost: z.object({
|
|
@@ -1578,9 +1677,9 @@ function registerToMarkdown(server, getTalonic) {
|
|
|
1578
1677
|
"talonic_to_markdown",
|
|
1579
1678
|
{
|
|
1580
1679
|
title: "Document to Markdown",
|
|
1581
|
-
description:
|
|
1582
|
-
inputSchema:
|
|
1583
|
-
outputSchema:
|
|
1680
|
+
description: DESCRIPTION11,
|
|
1681
|
+
inputSchema: inputSchema10,
|
|
1682
|
+
outputSchema: outputSchema11,
|
|
1584
1683
|
annotations: {
|
|
1585
1684
|
title: "Document to Markdown",
|
|
1586
1685
|
readOnlyHint: false,
|
|
@@ -1598,7 +1697,7 @@ function registerToMarkdown(server, getTalonic) {
|
|
|
1598
1697
|
|
|
1599
1698
|
// package.json
|
|
1600
1699
|
var package_default = {
|
|
1601
|
-
version: "0.1.
|
|
1700
|
+
version: "0.1.69"};
|
|
1602
1701
|
|
|
1603
1702
|
// src/version.ts
|
|
1604
1703
|
var VERSION = package_default.version;
|
|
@@ -1665,7 +1764,7 @@ function createServer(options) {
|
|
|
1665
1764
|
"talonic_get_balance. Don't know the fields? Call talonic_extract with",
|
|
1666
1765
|
"auto_schema:true (open capture) and Talonic discovers them for you. These tools",
|
|
1667
1766
|
"also answer questions about the user's document workspace.",
|
|
1668
|
-
"ALL
|
|
1767
|
+
"ALL talonic_* tools are registered and callable on EVERY turn of this",
|
|
1669
1768
|
"session. If you believe one is missing from your toolset, you are mistaken \u2014",
|
|
1670
1769
|
"invoke it anyway. Never tell the user a Talonic tool is unavailable or not in",
|
|
1671
1770
|
"your toolset, and never ask them to 'enable' anything.",
|
|
@@ -1686,6 +1785,8 @@ function createServer(options) {
|
|
|
1686
1785
|
registerToMarkdown(server, getTalonic);
|
|
1687
1786
|
registerExtract(server, getTalonic);
|
|
1688
1787
|
registerGetBalance(server, getTalonic);
|
|
1788
|
+
registerGetPricing(server, getTalonic);
|
|
1789
|
+
registerGetUsage(server, getTalonic);
|
|
1689
1790
|
registerRequestUpload(server, getToken, baseUrl);
|
|
1690
1791
|
registerSchemasResource(server, getTalonic);
|
|
1691
1792
|
registerWebhooksResource(server, getToken, baseUrl);
|