@talonic/mcp 0.1.65 → 0.1.66
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 +27 -10
- package/dist/http-server.js.map +1 -1
- package/dist/index.js +27 -10
- package/dist/index.js.map +1 -1
- package/dist/server.js +27 -10
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -874,6 +874,7 @@ var DESCRIPTION2 = [
|
|
|
874
874
|
"USE WHEN: value-based criteria on extracted fields \u2014 numeric/date/text comparisons or presence checks.",
|
|
875
875
|
"NOT FOR: free-text / concept search (use talonic_search) \xB7 a single document by id (use talonic_get_document).",
|
|
876
876
|
"ARGS: conditions[] (AND-ed). Each = EXACTLY ONE of `field` (canonical name) or `field_id` (UUID), an `operator`, and usually a `value`. Operators: eq, neq, gt, gte, lt, lte, between (needs `value` AND `value_to`), contains, is_empty / is_not_empty (no value). `value`/`value_to` are string|number|boolean matching the field type (ISO YYYY-MM-DD for dates).",
|
|
877
|
+
"TEXT FILTERS: for eq/contains/is_not_empty on a text field, just TRY a natural field name ('currency', 'vendor_name') \u2014 names resolve server-side and an unresolved field surfaces in warnings[] rather than erroring. Do NOT block on discovering the field first; search-first is only required for numeric operators.",
|
|
877
878
|
"NUMERIC GUARD: gt/gte/lt/lte/between only work when the field's dataType is 'number'. Call talonic_search first and check dataType; a numeric op on a string field returns zero matches. If the response has `warnings[]`, surface them to the user \u2014 do not silently retry.",
|
|
878
879
|
"RETURNS: data[] (matching documents with field values), total, warnings[]."
|
|
879
880
|
].join("\n");
|
|
@@ -1055,7 +1056,7 @@ var DESCRIPTION4 = [
|
|
|
1055
1056
|
"NOT FOR: full text (use talonic_to_markdown) \xB7 extracted fields (use talonic_extract).",
|
|
1056
1057
|
"BY NAME: if the user names a file, call talonic_search first to get its document_id, then call this.",
|
|
1057
1058
|
"ARGS: document_id.",
|
|
1058
|
-
"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."
|
|
1059
|
+
"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."
|
|
1059
1060
|
].join("\n");
|
|
1060
1061
|
var inputSchema4 = {
|
|
1061
1062
|
document_id: z.string().min(1).describe(
|
|
@@ -1283,16 +1284,17 @@ function registerSaveSchema(server, getTalonic) {
|
|
|
1283
1284
|
);
|
|
1284
1285
|
}
|
|
1285
1286
|
var DESCRIPTION7 = [
|
|
1286
|
-
"Find documents, fields, schemas, or sources in the workspace
|
|
1287
|
+
"Find documents, fields, schemas, or sources in the workspace. One call returns ranked results across all types.",
|
|
1287
1288
|
"",
|
|
1288
|
-
"
|
|
1289
|
+
"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.",
|
|
1290
|
+
"USE WHEN: the user names or describes a document without an id, or you need a document_id or a filterable field name before extract / to_markdown / get_document / filter.",
|
|
1289
1291
|
"NOT FOR: structured field-value filters like 'amount > 1000' (use talonic_filter).",
|
|
1290
|
-
"ARGS: query (
|
|
1292
|
+
"ARGS: query (short literal keyword); optional limit.",
|
|
1291
1293
|
"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."
|
|
1292
1294
|
].join("\n");
|
|
1293
1295
|
var inputSchema6 = {
|
|
1294
1296
|
query: z.string().min(1).describe(
|
|
1295
|
-
"
|
|
1297
|
+
"ONE short, SINGULAR keyword or an exact filename \u2014 'invoice', 'insurance certificate', 'sample-invoice.pdf'. Matching is literal: sentences and plurals return empty."
|
|
1296
1298
|
),
|
|
1297
1299
|
limit: z.number().int().positive().optional().describe("Maximum results per entity type. Default: 5. Increase for broader exploration.")
|
|
1298
1300
|
};
|
|
@@ -1336,6 +1338,9 @@ var outputSchema7 = {
|
|
|
1336
1338
|
})
|
|
1337
1339
|
).describe(
|
|
1338
1340
|
"Field-registry entries matching the query. filterable: true entries are usable with talonic_filter."
|
|
1341
|
+
),
|
|
1342
|
+
hint: z.string().optional().describe(
|
|
1343
|
+
"Present only when nothing matched: actionable guidance to retry with a shorter singular keyword."
|
|
1339
1344
|
)
|
|
1340
1345
|
};
|
|
1341
1346
|
async function handleSearch(talonic, args) {
|
|
@@ -1344,6 +1349,14 @@ async function handleSearch(talonic, args) {
|
|
|
1344
1349
|
args.query,
|
|
1345
1350
|
args.limit !== void 0 ? { limit: args.limit } : {}
|
|
1346
1351
|
);
|
|
1352
|
+
const r = result;
|
|
1353
|
+
const empty = (r["documents"]?.length ?? 0) === 0 && (r["fieldMatches"]?.length ?? 0) === 0 && (r["sources"]?.length ?? 0) === 0 && (r["schemas"]?.length ?? 0) === 0 && (r["fields"]?.length ?? 0) === 0;
|
|
1354
|
+
if (empty) {
|
|
1355
|
+
return jsonOk({
|
|
1356
|
+
...result,
|
|
1357
|
+
hint: "No matches. Matching is literal keyword search \u2014 retry with ONE short, SINGULAR term or an exact filename (e.g. 'invoice', not 'invoices' or a sentence) before concluding nothing exists."
|
|
1358
|
+
});
|
|
1359
|
+
}
|
|
1347
1360
|
return jsonOk(result);
|
|
1348
1361
|
} catch (err) {
|
|
1349
1362
|
return toolError(err);
|
|
@@ -1549,7 +1562,7 @@ function registerToMarkdown(server, getTalonic) {
|
|
|
1549
1562
|
|
|
1550
1563
|
// package.json
|
|
1551
1564
|
var package_default = {
|
|
1552
|
-
version: "0.1.
|
|
1565
|
+
version: "0.1.66"};
|
|
1553
1566
|
|
|
1554
1567
|
// src/version.ts
|
|
1555
1568
|
var VERSION = package_default.version;
|
|
@@ -1608,12 +1621,16 @@ function createServer(options) {
|
|
|
1608
1621
|
"Talonic turns any document (PDF, scan, image, DOCX, contract, invoice, form,",
|
|
1609
1622
|
"certificate, statement) into clean, schema-validated JSON, and answers questions",
|
|
1610
1623
|
"about the user's document workspace.",
|
|
1611
|
-
"
|
|
1612
|
-
"
|
|
1613
|
-
"
|
|
1624
|
+
"ALL NINE talonic_* tools are registered and callable on EVERY turn of this",
|
|
1625
|
+
"session. If you believe one is missing from your toolset, you are mistaken \u2014",
|
|
1626
|
+
"invoke it anyway. Never tell the user a Talonic tool is unavailable or not in",
|
|
1627
|
+
"your toolset, and never ask them to 'enable' anything.",
|
|
1614
1628
|
"If the user refers to a document by name (e.g. 'invoice.pdf'), first call",
|
|
1615
1629
|
"talonic_search to resolve the name to a document_id, then call the tool you need",
|
|
1616
|
-
"with that id \u2014 do not ask the user for an id.
|
|
1630
|
+
"with that id \u2014 do not ask the user for an id.",
|
|
1631
|
+
"talonic_search matches LITERAL keywords: query with one short singular term or an",
|
|
1632
|
+
"exact filename, never a sentence; on an empty result retry with a shorter keyword.",
|
|
1633
|
+
"Prefer acting over explaining."
|
|
1617
1634
|
].join(" ")
|
|
1618
1635
|
}
|
|
1619
1636
|
);
|