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