@talonic/mcp 0.1.15 → 0.1.17

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.
@@ -102,7 +102,7 @@ function registerWebhooksResource(server, apiKey, baseUrl) {
102
102
  );
103
103
  }
104
104
  function jsonOk(value) {
105
- return {
105
+ const result = {
106
106
  content: [
107
107
  {
108
108
  type: "text",
@@ -110,6 +110,10 @@ function jsonOk(value) {
110
110
  }
111
111
  ]
112
112
  };
113
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
114
+ result["structuredContent"] = value;
115
+ }
116
+ return result;
113
117
  }
114
118
  function validationError(message) {
115
119
  return {
@@ -159,18 +163,22 @@ var DESCRIPTION = [
159
163
  "- The user just wants the full text content (use talonic_to_markdown after extracting once).",
160
164
  "- The user wants to find documents matching a query (use talonic_search or talonic_filter).",
161
165
  "",
162
- "FILE SOURCES (provide exactly one):",
163
- "- file_data + filename (RECOMMENDED for chat clients): base64-encoded file bytes plus",
164
- " the original filename (with extension). Use this whenever you already have the file",
165
- " in memory, e.g. the user attached it to the conversation. Works in every MCP client",
166
- " regardless of where the file lives on disk.",
167
- "- file_path: a local path to the document. Only works if the MCP server process can",
168
- " read that path on its own filesystem; many chat clients (Claude Desktop, Cowork)",
169
- " store user uploads in a sandbox the MCP server cannot access, in which case use",
170
- " file_data instead.",
171
- "- file_url: a URL the Talonic API will fetch directly. Use for documents already on",
172
- " the public web.",
173
- "- document_id: re-extract a document already in the workspace.",
166
+ "FILE SOURCES (provide exactly EXACTLY ONE; never combine, e.g. do NOT pass both file_data and file_path):",
167
+ "- file_data + filename: base64-encoded file bytes plus the original filename (with extension).",
168
+ " RECOMMENDED for local-stdio installs (Claude Desktop, Cursor, Cline, Continue, Cowork).",
169
+ " WARNING for hosted-MCP via Claude.ai connectors: Claude.ai imposes a hard size limit on",
170
+ " tool-call arguments (effectively under ~1KB), so file_data CANNOT carry a real PDF through",
171
+ " Claude.ai's pipeline. The bytes get truncated before reaching the MCP server. For files",
172
+ " larger than a trivial test, use file_url or document_id instead when running through",
173
+ " Claude.ai. Local stdio installs do NOT have this limit.",
174
+ "- file_path: a local path to the document. Only works if the MCP server process can read",
175
+ " that path on its own filesystem. Chat clients (Claude Desktop, Claude.ai, Cowork) store",
176
+ " user uploads in a sandbox the MCP server cannot access, so file_path is only useful when",
177
+ " the agent explicitly knows a path on the same machine as the MCP server.",
178
+ "- file_url: a URL the Talonic API will fetch directly. Use for documents already on the",
179
+ " public web. Best path for Claude.ai users dealing with files larger than the parameter cap.",
180
+ "- document_id: re-extract a document already in the workspace. Cheapest option when the",
181
+ " document is already uploaded via app.talonic.com or a previous extract call.",
174
182
  "",
175
183
  "SCHEMA (REQUIRED, provide exactly one of `schema` or `schema_id`):",
176
184
  '- JSON Schema (RECOMMENDED): { type: "object", properties: { vendor_name: { type: "string" } } }.',
@@ -220,6 +228,52 @@ var inputSchema = {
220
228
  "Include per-field provenance (source_text, section, page) showing where each value was found in the document."
221
229
  )
222
230
  };
231
+ var outputSchema = {
232
+ extraction_id: z.string().describe("Stable identifier for this extraction."),
233
+ request_id: z.string().optional().describe("Server-assigned request ID for support and debugging."),
234
+ status: z.string().describe("Extraction status (e.g. 'complete')."),
235
+ document: z.object({
236
+ id: z.string(),
237
+ filename: z.string(),
238
+ pages: z.number().optional(),
239
+ size_bytes: z.number().optional(),
240
+ mime_type: z.string().optional(),
241
+ type_detected: z.string().nullable().optional(),
242
+ language_detected: z.string().nullable().optional()
243
+ }).describe("Metadata about the ingested document."),
244
+ data: z.record(z.string(), z.unknown()).describe("The extracted structured data, shape determined by the schema."),
245
+ schema: z.object({
246
+ source: z.string().optional(),
247
+ id: z.string().nullable().optional(),
248
+ definition: z.record(z.string(), z.unknown()).optional(),
249
+ save_url: z.string().optional()
250
+ }).optional().describe("Schema metadata: which schema was used and how it can be saved."),
251
+ confidence: z.object({
252
+ overall: z.number().describe("0..1 confidence for the extraction as a whole."),
253
+ fields: z.record(z.string(), z.number()).describe("Per-field confidence map (0..1).")
254
+ }).optional().describe("Extraction confidence. Treat fields below ~0.7 as needing human review."),
255
+ provenance: z.record(
256
+ z.string(),
257
+ z.object({
258
+ source_text: z.string().optional(),
259
+ section: z.string().optional(),
260
+ page: z.number().optional()
261
+ })
262
+ ).optional().describe(
263
+ "Per-field source evidence (source_text, section, page). Present only when `include_provenance: true`."
264
+ ),
265
+ processing: z.object({
266
+ duration_ms: z.number().optional(),
267
+ pages_processed: z.number().optional(),
268
+ region: z.string().optional()
269
+ }).optional().describe("Processing metadata: duration, pages processed, region."),
270
+ links: z.object({
271
+ self: z.string().optional(),
272
+ document: z.string().optional(),
273
+ dashboard: z.string().optional()
274
+ }).optional().describe("URLs for self, document, and human-readable dashboard view."),
275
+ markdown: z.string().optional().describe("OCR-converted markdown. Present only when `include_markdown: true`.")
276
+ };
223
277
  async function handleExtract(talonic, args) {
224
278
  if (args.schema === void 0 && args.schema_id === void 0) {
225
279
  return validationError(
@@ -256,7 +310,14 @@ function registerExtract(server, talonic) {
256
310
  {
257
311
  title: "Extract Data from Document",
258
312
  description: DESCRIPTION,
259
- inputSchema
313
+ inputSchema,
314
+ outputSchema,
315
+ annotations: {
316
+ title: "Extract Data from Document",
317
+ readOnlyHint: false,
318
+ destructiveHint: false,
319
+ openWorldHint: true
320
+ }
260
321
  },
261
322
  async (args) => handleExtract(talonic, args)
262
323
  );
@@ -286,6 +347,9 @@ var DESCRIPTION2 = [
286
347
  "- contains: substring match on string fields.",
287
348
  "- is_empty: presence check, no value needed. Returns documents where the field is null or missing.",
288
349
  "",
350
+ "SCHEMA TYPING:",
351
+ "- Numeric operators (`gt`, `gte`, `lt`, `lte`, `between`) only resolve correctly when the schema field is typed as `number`. A field typed as `string` that holds numeric content (e.g. '\u20AC1,500.00') will silently return zero matches even after extraction. Pick the right type at schema design time.",
352
+ "",
289
353
  "NOT SUPPORTED IN v0.1:",
290
354
  "- is_not_empty: underreports against fields known to be populated. Removed from the supported operator list to keep filter results trustworthy. Workaround: filter with `eq`/`gt`/`contains` against a known value, or use `is_empty` then invert the result client-side. Tracked for a later release.",
291
355
  "",
@@ -332,6 +396,23 @@ var inputSchema2 = {
332
396
  limit: z.number().int().positive().optional().describe("Results per page. Default 50 server-side."),
333
397
  source_connection_id: z.string().optional().describe("Optionally scope to a specific source connection.")
334
398
  };
399
+ var outputSchema2 = {
400
+ data: z.array(
401
+ z.object({
402
+ document_id: z.string().optional(),
403
+ filename: z.string().optional(),
404
+ fields: z.record(z.string(), z.unknown()).optional()
405
+ }).passthrough()
406
+ ).describe("Documents matching the filter conditions, with their extracted field values."),
407
+ total: z.number().optional().describe("Total documents matching across all pages."),
408
+ page: z.number().optional().describe("Current page number."),
409
+ pagination: z.object({
410
+ total: z.number().optional(),
411
+ limit: z.number().optional(),
412
+ has_more: z.boolean().optional(),
413
+ next_cursor: z.string().nullable().optional()
414
+ }).optional().describe("Cursor-based pagination metadata.")
415
+ };
335
416
  async function handleFilter(talonic, args) {
336
417
  try {
337
418
  const conditions = args.conditions.map((c) => {
@@ -367,7 +448,13 @@ function registerFilter(server, talonic) {
367
448
  {
368
449
  title: "Filter Talonic Documents",
369
450
  description: DESCRIPTION2,
370
- inputSchema: inputSchema2
451
+ inputSchema: inputSchema2,
452
+ outputSchema: outputSchema2,
453
+ annotations: {
454
+ title: "Filter Talonic Documents",
455
+ readOnlyHint: true,
456
+ openWorldHint: true
457
+ }
371
458
  },
372
459
  async (args) => handleFilter(talonic, args)
373
460
  );
@@ -394,6 +481,48 @@ var inputSchema3 = {
394
481
  "The Talonic document ID. Get this from a previous talonic_extract or talonic_search response."
395
482
  )
396
483
  };
484
+ var outputSchema3 = {
485
+ id: z.string(),
486
+ filename: z.string().optional(),
487
+ pages: z.number().optional(),
488
+ size_bytes: z.number().optional(),
489
+ mime_type: z.string().optional(),
490
+ type_detected: z.string().nullable().optional(),
491
+ language_detected: z.string().nullable().optional(),
492
+ status: z.string().optional(),
493
+ source: z.object({
494
+ id: z.string().optional(),
495
+ type: z.string().optional()
496
+ }).optional(),
497
+ triage: z.object({
498
+ sensitivity: z.string().optional(),
499
+ department: z.string().optional(),
500
+ jurisdiction: z.string().nullable().optional(),
501
+ pii_detected: z.boolean().optional(),
502
+ pii_categories: z.array(z.string()).nullable().optional(),
503
+ regulated_data: z.boolean().optional(),
504
+ confidentiality_marking: z.string().nullable().optional()
505
+ }).optional(),
506
+ original_path: z.string().nullable().optional(),
507
+ extraction_count: z.number().optional(),
508
+ latest_extraction_id: z.string().nullable().optional(),
509
+ processing_log: z.array(
510
+ z.object({
511
+ step: z.string().optional(),
512
+ detail: z.string().optional(),
513
+ status: z.string().optional(),
514
+ started_at: z.string().optional(),
515
+ completed_at: z.string().optional(),
516
+ duration_ms: z.number().optional()
517
+ })
518
+ ).optional(),
519
+ created_at: z.string().optional(),
520
+ links: z.object({
521
+ self: z.string().optional(),
522
+ extractions: z.string().optional(),
523
+ dashboard: z.string().optional()
524
+ }).optional()
525
+ };
397
526
  async function handleGetDocument(talonic, args) {
398
527
  try {
399
528
  const result = await talonic.documents.get(args.document_id);
@@ -408,13 +537,17 @@ function registerGetDocument(server, talonic) {
408
537
  {
409
538
  title: "Get Talonic Document",
410
539
  description: DESCRIPTION3,
411
- inputSchema: inputSchema3
540
+ inputSchema: inputSchema3,
541
+ outputSchema: outputSchema3,
542
+ annotations: {
543
+ title: "Get Talonic Document",
544
+ readOnlyHint: true,
545
+ openWorldHint: true
546
+ }
412
547
  },
413
548
  async (args) => handleGetDocument(talonic, args)
414
549
  );
415
550
  }
416
-
417
- // src/tools/list-schemas.ts
418
551
  var DESCRIPTION4 = [
419
552
  "STATUS: stable.",
420
553
  "",
@@ -434,6 +567,31 @@ var DESCRIPTION4 = [
434
567
  "",
435
568
  "TIP: Pair this with talonic_extract by passing the chosen schema's id as `schema_id`."
436
569
  ].join("\n");
570
+ var schemaItem = z.object({
571
+ id: z.string().describe("UUID of the schema."),
572
+ short_id: z.string().optional().describe("Human-readable short id (SCH-XXXXXXXX)."),
573
+ name: z.string(),
574
+ description: z.string().optional(),
575
+ definition: z.record(z.string(), z.unknown()).optional(),
576
+ field_count: z.number().optional(),
577
+ version: z.number().optional(),
578
+ created_at: z.string().optional(),
579
+ updated_at: z.string().optional(),
580
+ links: z.object({
581
+ self: z.string().optional(),
582
+ extractions: z.string().optional(),
583
+ dashboard: z.string().optional()
584
+ }).optional()
585
+ });
586
+ var outputSchema4 = {
587
+ data: z.array(schemaItem).describe("Saved schemas in the workspace."),
588
+ pagination: z.object({
589
+ total: z.number().optional(),
590
+ limit: z.number().optional(),
591
+ has_more: z.boolean().optional(),
592
+ next_cursor: z.string().nullable().optional()
593
+ }).optional().describe("Cursor-based pagination metadata.")
594
+ };
437
595
  async function handleListSchemas(talonic) {
438
596
  try {
439
597
  const result = await talonic.schemas.list();
@@ -448,7 +606,13 @@ function registerListSchemas(server, talonic) {
448
606
  {
449
607
  title: "List Talonic Schemas",
450
608
  description: DESCRIPTION4,
451
- inputSchema: {}
609
+ inputSchema: {},
610
+ outputSchema: outputSchema4,
611
+ annotations: {
612
+ title: "List Talonic Schemas",
613
+ readOnlyHint: true,
614
+ openWorldHint: true
615
+ }
452
616
  },
453
617
  async () => handleListSchemas(talonic)
454
618
  );
@@ -481,6 +645,22 @@ var inputSchema4 = {
481
645
  ),
482
646
  description: z.string().optional().describe("Optional description of what this schema extracts and when to use it.")
483
647
  };
648
+ var outputSchema5 = {
649
+ id: z.string().describe("UUID of the newly saved schema."),
650
+ short_id: z.string().optional().describe("Human-readable short id (SCH-XXXXXXXX)."),
651
+ name: z.string(),
652
+ description: z.string().optional(),
653
+ definition: z.record(z.string(), z.unknown()).optional().describe("Final schema definition as stored, normalised by the API."),
654
+ field_count: z.number().optional(),
655
+ version: z.number().optional().describe("Schema version (1 for new schemas; increments on update)."),
656
+ created_at: z.string().optional(),
657
+ updated_at: z.string().optional(),
658
+ links: z.object({
659
+ self: z.string().optional(),
660
+ extractions: z.string().optional(),
661
+ dashboard: z.string().optional()
662
+ }).optional()
663
+ };
484
664
  async function handleSaveSchema(talonic, args) {
485
665
  try {
486
666
  const result = await talonic.schemas.create({
@@ -499,7 +679,14 @@ function registerSaveSchema(server, talonic) {
499
679
  {
500
680
  title: "Save Talonic Schema",
501
681
  description: DESCRIPTION5,
502
- inputSchema: inputSchema4
682
+ inputSchema: inputSchema4,
683
+ outputSchema: outputSchema5,
684
+ annotations: {
685
+ title: "Save Talonic Schema",
686
+ readOnlyHint: false,
687
+ destructiveHint: false,
688
+ openWorldHint: true
689
+ }
503
690
  },
504
691
  async (args) => handleSaveSchema(talonic, args)
505
692
  );
@@ -532,6 +719,40 @@ var inputSchema5 = {
532
719
  ),
533
720
  limit: z.number().int().positive().optional().describe("Maximum results per entity type. Default: 5. Increase for broader exploration.")
534
721
  };
722
+ var outputSchema6 = {
723
+ documents: z.array(
724
+ z.object({
725
+ id: z.string(),
726
+ name: z.string().optional(),
727
+ sourceId: z.string().optional(),
728
+ sourceName: z.string().optional()
729
+ })
730
+ ).describe("Documents matching the query."),
731
+ fieldMatches: z.array(
732
+ z.object({
733
+ resolvedFieldId: z.string().nullable(),
734
+ displayName: z.string().optional(),
735
+ matchedValue: z.string().optional(),
736
+ documentCount: z.number().optional(),
737
+ filterable: z.boolean().describe("Only filterable: true entries can be used with talonic_filter.")
738
+ })
739
+ ).describe(
740
+ "Field-level matches with a filterable flag indicating whether the entry can drive talonic_filter."
741
+ ),
742
+ sources: z.array(z.object({ id: z.string(), name: z.string().optional() })).describe("Source connections matching the query."),
743
+ schemas: z.array(z.object({ id: z.string(), name: z.string().optional() })).describe("Saved schemas matching the query."),
744
+ fields: z.array(
745
+ z.object({
746
+ id: z.string(),
747
+ canonicalName: z.string().optional(),
748
+ displayName: z.string().optional(),
749
+ documentCount: z.number().optional(),
750
+ filterable: z.boolean().optional()
751
+ })
752
+ ).describe(
753
+ "Field-registry entries matching the query. filterable: true entries are usable with talonic_filter."
754
+ )
755
+ };
535
756
  async function handleSearch(talonic, args) {
536
757
  try {
537
758
  const result = await talonic.search(
@@ -549,7 +770,13 @@ function registerSearch(server, talonic) {
549
770
  {
550
771
  title: "Search Talonic Workspace",
551
772
  description: DESCRIPTION6,
552
- inputSchema: inputSchema5
773
+ inputSchema: inputSchema5,
774
+ outputSchema: outputSchema6,
775
+ annotations: {
776
+ title: "Search Talonic Workspace",
777
+ readOnlyHint: true,
778
+ openWorldHint: true
779
+ }
553
780
  },
554
781
  async (args) => handleSearch(talonic, args)
555
782
  );
@@ -594,6 +821,10 @@ var inputSchema6 = {
594
821
  ),
595
822
  file_url: z.string().optional().describe("URL to a document file. The Talonic API fetches it server-side.")
596
823
  };
824
+ var outputSchema7 = {
825
+ document_id: z.string().describe("ID of the document the markdown was extracted from."),
826
+ markdown: z.string().describe("OCR-converted markdown text content of the document.")
827
+ };
597
828
  var INGEST_ONLY_SCHEMA = {
598
829
  type: "object",
599
830
  properties: {
@@ -645,7 +876,14 @@ function registerToMarkdown(server, talonic) {
645
876
  {
646
877
  title: "Document to Markdown",
647
878
  description: DESCRIPTION7,
648
- inputSchema: inputSchema6
879
+ inputSchema: inputSchema6,
880
+ outputSchema: outputSchema7,
881
+ annotations: {
882
+ title: "Document to Markdown",
883
+ readOnlyHint: false,
884
+ destructiveHint: false,
885
+ openWorldHint: true
886
+ }
649
887
  },
650
888
  async (args) => handleToMarkdown(talonic, args)
651
889
  );
@@ -653,7 +891,7 @@ function registerToMarkdown(server, talonic) {
653
891
 
654
892
  // package.json
655
893
  var package_default = {
656
- version: "0.1.15"};
894
+ version: "0.1.17"};
657
895
 
658
896
  // src/version.ts
659
897
  var VERSION = package_default.version;