@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/index.js
CHANGED
|
@@ -872,6 +872,7 @@ var DESCRIPTION2 = [
|
|
|
872
872
|
"USE WHEN: value-based criteria on extracted fields \u2014 numeric/date/text comparisons or presence checks.",
|
|
873
873
|
"NOT FOR: free-text / concept search (use talonic_search) \xB7 a single document by id (use talonic_get_document).",
|
|
874
874
|
"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).",
|
|
875
|
+
"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.",
|
|
875
876
|
"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.",
|
|
876
877
|
"RETURNS: data[] (matching documents with field values), total, warnings[]."
|
|
877
878
|
].join("\n");
|
|
@@ -1053,7 +1054,7 @@ var DESCRIPTION4 = [
|
|
|
1053
1054
|
"NOT FOR: full text (use talonic_to_markdown) \xB7 extracted fields (use talonic_extract).",
|
|
1054
1055
|
"BY NAME: if the user names a file, call talonic_search first to get its document_id, then call this.",
|
|
1055
1056
|
"ARGS: document_id.",
|
|
1056
|
-
"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."
|
|
1057
|
+
"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."
|
|
1057
1058
|
].join("\n");
|
|
1058
1059
|
var inputSchema4 = {
|
|
1059
1060
|
document_id: z.string().min(1).describe(
|
|
@@ -1281,16 +1282,17 @@ function registerSaveSchema(server, getTalonic) {
|
|
|
1281
1282
|
);
|
|
1282
1283
|
}
|
|
1283
1284
|
var DESCRIPTION7 = [
|
|
1284
|
-
"Find documents, fields, schemas, or sources in the workspace
|
|
1285
|
+
"Find documents, fields, schemas, or sources in the workspace. One call returns ranked results across all types.",
|
|
1285
1286
|
"",
|
|
1286
|
-
"
|
|
1287
|
+
"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.",
|
|
1288
|
+
"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.",
|
|
1287
1289
|
"NOT FOR: structured field-value filters like 'amount > 1000' (use talonic_filter).",
|
|
1288
|
-
"ARGS: query (
|
|
1290
|
+
"ARGS: query (short literal keyword); optional limit.",
|
|
1289
1291
|
"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."
|
|
1290
1292
|
].join("\n");
|
|
1291
1293
|
var inputSchema6 = {
|
|
1292
1294
|
query: z.string().min(1).describe(
|
|
1293
|
-
"
|
|
1295
|
+
"ONE short, SINGULAR keyword or an exact filename \u2014 'invoice', 'insurance certificate', 'sample-invoice.pdf'. Matching is literal: sentences and plurals return empty."
|
|
1294
1296
|
),
|
|
1295
1297
|
limit: z.number().int().positive().optional().describe("Maximum results per entity type. Default: 5. Increase for broader exploration.")
|
|
1296
1298
|
};
|
|
@@ -1334,6 +1336,9 @@ var outputSchema7 = {
|
|
|
1334
1336
|
})
|
|
1335
1337
|
).describe(
|
|
1336
1338
|
"Field-registry entries matching the query. filterable: true entries are usable with talonic_filter."
|
|
1339
|
+
),
|
|
1340
|
+
hint: z.string().optional().describe(
|
|
1341
|
+
"Present only when nothing matched: actionable guidance to retry with a shorter singular keyword."
|
|
1337
1342
|
)
|
|
1338
1343
|
};
|
|
1339
1344
|
async function handleSearch(talonic, args) {
|
|
@@ -1342,6 +1347,14 @@ async function handleSearch(talonic, args) {
|
|
|
1342
1347
|
args.query,
|
|
1343
1348
|
args.limit !== void 0 ? { limit: args.limit } : {}
|
|
1344
1349
|
);
|
|
1350
|
+
const r = result;
|
|
1351
|
+
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;
|
|
1352
|
+
if (empty) {
|
|
1353
|
+
return jsonOk({
|
|
1354
|
+
...result,
|
|
1355
|
+
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."
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1345
1358
|
return jsonOk(result);
|
|
1346
1359
|
} catch (err) {
|
|
1347
1360
|
return toolError(err);
|
|
@@ -1547,7 +1560,7 @@ function registerToMarkdown(server, getTalonic) {
|
|
|
1547
1560
|
|
|
1548
1561
|
// package.json
|
|
1549
1562
|
var package_default = {
|
|
1550
|
-
version: "0.1.
|
|
1563
|
+
version: "0.1.66"};
|
|
1551
1564
|
|
|
1552
1565
|
// src/version.ts
|
|
1553
1566
|
var VERSION = package_default.version;
|
|
@@ -1606,12 +1619,16 @@ function createServer(options) {
|
|
|
1606
1619
|
"Talonic turns any document (PDF, scan, image, DOCX, contract, invoice, form,",
|
|
1607
1620
|
"certificate, statement) into clean, schema-validated JSON, and answers questions",
|
|
1608
1621
|
"about the user's document workspace.",
|
|
1609
|
-
"
|
|
1610
|
-
"
|
|
1611
|
-
"
|
|
1622
|
+
"ALL NINE talonic_* tools are registered and callable on EVERY turn of this",
|
|
1623
|
+
"session. If you believe one is missing from your toolset, you are mistaken \u2014",
|
|
1624
|
+
"invoke it anyway. Never tell the user a Talonic tool is unavailable or not in",
|
|
1625
|
+
"your toolset, and never ask them to 'enable' anything.",
|
|
1612
1626
|
"If the user refers to a document by name (e.g. 'invoice.pdf'), first call",
|
|
1613
1627
|
"talonic_search to resolve the name to a document_id, then call the tool you need",
|
|
1614
|
-
"with that id \u2014 do not ask the user for an id.
|
|
1628
|
+
"with that id \u2014 do not ask the user for an id.",
|
|
1629
|
+
"talonic_search matches LITERAL keywords: query with one short singular term or an",
|
|
1630
|
+
"exact filename, never a sentence; on an empty result retry with a shorter keyword.",
|
|
1631
|
+
"Prefer acting over explaining."
|
|
1615
1632
|
].join(" ")
|
|
1616
1633
|
}
|
|
1617
1634
|
);
|