@talonic/mcp 0.1.49 → 0.1.51

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/content.js CHANGED
@@ -31,7 +31,9 @@ var MCP_NAV_SECTIONS = [
31
31
  { id: "talonic-get-document", label: "talonic_get_document" },
32
32
  { id: "talonic-to-markdown", label: "talonic_to_markdown" },
33
33
  { id: "talonic-list-schemas", label: "talonic_list_schemas" },
34
- { id: "talonic-save-schema", label: "talonic_save_schema" }
34
+ { id: "talonic-save-schema", label: "talonic_save_schema" },
35
+ { id: "talonic-get-balance", label: "talonic_get_balance" },
36
+ { id: "talonic-request-upload", label: "talonic_request_upload" }
35
37
  ]
36
38
  },
37
39
  {
@@ -1462,6 +1464,11 @@ var sections3 = [
1462
1464
  variant: "info",
1463
1465
  text: "Search results include canonical field names in `fields[].canonicalName`. These names can be used directly in `talonic_filter` conditions, making search a good first step before building precise filters."
1464
1466
  },
1467
+ {
1468
+ type: "callout",
1469
+ variant: "info",
1470
+ text: 'Every `fieldMatches[]` and `fields[]` entry carries a `dataType` (`"string"`, `"number"`, `"array"`, etc.). Use it to pick the right `talonic_filter` operator on the first call \u2014 numeric operators (`gt`, `gte`, `lt`, `lte`, `between`) only resolve correctly when `dataType === "number"`. See the *Schema typing* section under `talonic_filter` for the full preventive / reactive pattern.'
1471
+ },
1465
1472
  { type: "heading", level: 3, id: "search-example", text: "Example" },
1466
1473
  {
1467
1474
  type: "code",
@@ -1490,13 +1497,16 @@ var sections3 = [
1490
1497
  "fieldName": "indemnification.cap_amount",
1491
1498
  "documentId": "doc_4e7b...",
1492
1499
  "value": "2x annual fees",
1500
+ "documentCount": 3,
1501
+ "filterable": true,
1502
+ "dataType": "string",
1493
1503
  "score": 0.88
1494
1504
  }
1495
1505
  ],
1496
1506
  "schemas": [],
1497
1507
  "sources": [],
1498
1508
  "fields": [
1499
- { "canonicalName": "indemnification.cap_amount", "type": "string" }
1509
+ { "canonicalName": "indemnification.cap_amount", "dataType": "string", "filterable": true }
1500
1510
  ]
1501
1511
  }`
1502
1512
  },
@@ -1511,12 +1521,12 @@ var sections3 = [
1511
1521
  "limit": 5
1512
1522
  }
1513
1523
 
1514
- // Response includes canonical field names:
1524
+ // Response includes canonical field names plus dataType:
1515
1525
  {
1516
1526
  "fields": [
1517
- { "canonicalName": "vendor.name", "type": "string", "filterable": true },
1518
- { "canonicalName": "invoice.total_eur", "type": "number", "filterable": true },
1519
- { "canonicalName": "invoice.due_date", "type": "string", "filterable": true }
1527
+ { "canonicalName": "vendor.name", "dataType": "string", "filterable": true },
1528
+ { "canonicalName": "invoice.total_eur", "dataType": "number", "filterable": true },
1529
+ { "canonicalName": "invoice.due_date", "dataType": "string", "filterable": true }
1520
1530
  ]
1521
1531
  }`
1522
1532
  },
@@ -1659,7 +1669,55 @@ var sections3 = [
1659
1669
  { type: "heading", level: 3, id: "filter-operators", text: "Available operators" },
1660
1670
  {
1661
1671
  type: "paragraph",
1662
- text: "The following operators are available for filter conditions: `eq` (equals), `neq` (not equals), `gt` (greater than), `gte` (greater than or equal), `lt` (less than), `lte` (less than or equal), `between` (range, requires a two-element array as value), `contains` (substring match), `starts_with`, `ends_with`, and `is_empty` (checks for null or empty values). Numeric operators (`gt`, `gte`, `lt`, `lte`, `between`) only work on fields typed as `number` in the schema \u2014 using them on string fields silently returns zero results."
1672
+ text: "The following operators are available for filter conditions: `eq` (equals), `neq` (not equals), `gt` (greater than), `gte` (greater than or equal), `lt` (less than), `lte` (less than or equal), `between` (range, requires a two-element array as value), `contains` (substring match), `starts_with`, `ends_with`, `is_empty` (checks for null or empty values), and `is_not_empty` (checks for materialized values). Numeric operators (`gt`, `gte`, `lt`, `lte`, `between`) only resolve correctly when the schema field is typed as `number`. The next section explains how to handle that constraint."
1673
+ },
1674
+ {
1675
+ type: "heading",
1676
+ level: 3,
1677
+ id: "filter-schema-typing",
1678
+ text: "Schema typing (preventive + reactive)"
1679
+ },
1680
+ {
1681
+ type: "paragraph",
1682
+ text: 'A numeric operator on a string-typed field that happens to hold numeric content (e.g. `"\u20AC1,500.00"`) silently returns zero matches \u2014 the comparison falls back to lexicographic ordering and almost never produces the result the user expects. There are two ways to handle this; pick the right one before constructing the call.'
1683
+ },
1684
+ {
1685
+ type: "heading",
1686
+ level: 3,
1687
+ id: "filter-preventive",
1688
+ text: "Preventive \u2014 gate on `dataType`"
1689
+ },
1690
+ {
1691
+ type: "paragraph",
1692
+ text: 'Call `talonic_search` first and read `dataType` on the field entry. If `dataType !== "number"`, do not issue a numeric operator on that field. Pick a string-friendly operator (`eq`, `contains`) or warn the user that the field needs a `data_type` change in the schema definition before the query can succeed. This avoids the silent-zero-matches outcome entirely.'
1693
+ },
1694
+ {
1695
+ type: "heading",
1696
+ level: 3,
1697
+ id: "filter-reactive",
1698
+ text: "Reactive \u2014 handle `warnings[]`"
1699
+ },
1700
+ {
1701
+ type: "paragraph",
1702
+ text: "When a numeric operator is applied to a string-typed field anyway, the API attaches a `warnings[]` array to the filter response. Each entry has `code`, `message`, `field`/`field_id`, and a `suggestion`. The MCP tool surfaces this in `structuredContent` \u2014 agents should relay the `message` (and `suggestion`, when present) to the user rather than silently retrying."
1703
+ },
1704
+ {
1705
+ type: "code",
1706
+ language: "json",
1707
+ title: "Response with a warning",
1708
+ code: `{
1709
+ "data": [],
1710
+ "total": 0,
1711
+ "warnings": [
1712
+ {
1713
+ "code": "numeric_operator_on_string_field",
1714
+ "message": "Operator \`gt\` was applied to field \`invoice_total\` typed as string. Numeric comparisons against string-typed fields use lexicographic ordering and may return zero matches.",
1715
+ "field": "invoice_total",
1716
+ "field_id": "fld_inv_total",
1717
+ "suggestion": "Change the field's data_type to \`number\` in the schema definition."
1718
+ }
1719
+ ]
1720
+ }`
1663
1721
  },
1664
1722
  {
1665
1723
  type: "heading",
@@ -2481,6 +2539,167 @@ Payment terms: Net 30`
2481
2539
  }
2482
2540
  ],
2483
2541
  mentions: ["credits", "balance", "EUR", "burn rate", "runway", "tier", "budget"]
2542
+ },
2543
+ {
2544
+ slug: "talonic-request-upload",
2545
+ parentSlug: "tools",
2546
+ title: "talonic_request_upload",
2547
+ seoTitle: "talonic_request_upload Tool \u2014 Talonic MCP",
2548
+ description: "Request a browser-handoff upload link for files that can't be delivered via tool-call arguments. Returns a pre-allocated document_id, an upload URL, and an expiry timestamp.",
2549
+ content: [
2550
+ {
2551
+ type: "paragraph",
2552
+ text: "Request a one-time upload link for a file the agent cannot deliver directly. Returns a pre-allocated `document_id`, a browser-openable `upload_url` the user drops the file into, and an `expires_at` timestamp."
2553
+ },
2554
+ {
2555
+ type: "paragraph",
2556
+ text: "**`talonic_request_upload`** exists to route around the **~32 KB tool-call argument cap** in hosted-connector environments like Claude.ai's web UI. Above that ceiling, `file_data` on `talonic_extract` is silently truncated and the extraction returns null fields. The browser-handoff flow sidesteps the cap entirely: the user opens the upload URL in a separate tab, drops the file, and the agent then references the resulting document by ID."
2557
+ },
2558
+ {
2559
+ type: "paragraph",
2560
+ text: "Local-stdio installs (Claude Desktop, Cursor, Cline, Continue, Cowork) do not have this cap and should keep using `file_data` for small-to-medium files. This tool is for the hosted connector path or any sandboxed environment where you can't reliably stream the file through the tool call."
2561
+ },
2562
+ { type: "heading", level: 3, id: "request-upload-use-when", text: "When to use" },
2563
+ {
2564
+ type: "list",
2565
+ items: [
2566
+ "The user has a file to extract and you are running in a hosted-connector environment (Claude.ai, ChatGPT) where `file_data` is not reliable.",
2567
+ "The file is larger than ~32 KB (typical for real invoices, contracts, COIs).",
2568
+ "The user explicitly asks for an upload link."
2569
+ ]
2570
+ },
2571
+ { type: "heading", level: 3, id: "request-upload-do-not-use", text: "When not to use" },
2572
+ {
2573
+ type: "list",
2574
+ items: [
2575
+ "You can deliver the file directly via `file_data` (local-stdio installs with small files).",
2576
+ "The file is already accessible via a public URL \u2014 use `file_url` on `talonic_extract` instead.",
2577
+ "The document is already in the workspace \u2014 use `document_id` on `talonic_extract` instead."
2578
+ ]
2579
+ },
2580
+ {
2581
+ type: "param-table",
2582
+ params: [
2583
+ {
2584
+ name: "filename",
2585
+ type: "string",
2586
+ required: true,
2587
+ description: "Filename with extension (e.g. `invoice.pdf`). Used to pre-allocate the document record and infer MIME type."
2588
+ }
2589
+ ]
2590
+ },
2591
+ {
2592
+ type: "code",
2593
+ language: "json",
2594
+ title: "Tool input",
2595
+ code: `{
2596
+ "filename": "invoice-2026-001.pdf"
2597
+ }`
2598
+ },
2599
+ {
2600
+ type: "code",
2601
+ language: "json",
2602
+ title: "Tool response",
2603
+ code: `{
2604
+ "document_id": "doc_8f3a2b9c-1d4e-5f6a-7b8c-9d0e1f2a3b4c",
2605
+ "upload_url": "https://app.talonic.com/upload/u_3f9d2a1c8b7e6f5d4c3b2a1f0e9d8c7b",
2606
+ "expires_at": "2026-05-28T20:35:00.000Z"
2607
+ }`
2608
+ },
2609
+ {
2610
+ type: "heading",
2611
+ level: 3,
2612
+ id: "request-upload-workflow",
2613
+ text: "End-to-end workflow"
2614
+ },
2615
+ {
2616
+ type: "list",
2617
+ ordered: true,
2618
+ items: [
2619
+ "Call `talonic_request_upload` with the filename. Capture `document_id`, `upload_url`, and `expires_at` from the response.",
2620
+ "Show the `upload_url` to the user and ask them to open it in a new browser tab and drop the file.",
2621
+ 'Poll `talonic_get_document` with the `document_id` until `status` is `completed`. **Do not skip this step** \u2014 a user confirmation like "uploaded" only signals that the browser-side upload finished, not that server-side OCR and processing are done.',
2622
+ 'Once `status === "completed"`, call `talonic_extract` with the `document_id` and a `schema` or `schema_id` to pull out structured fields.'
2623
+ ]
2624
+ },
2625
+ {
2626
+ type: "callout",
2627
+ variant: "warning",
2628
+ text: 'Server-side processing (OCR + classification) typically takes 10\u201330 seconds after the browser upload completes. The agent must poll `talonic_get_document` until `status === "completed"` before calling `talonic_extract`. Calling extract too early returns errors that look like the file is missing.'
2629
+ },
2630
+ {
2631
+ type: "code",
2632
+ language: "json",
2633
+ title: "Full sequence for a Claude.ai hosted-connector chat",
2634
+ code: `// 1. Agent requests an upload link.
2635
+ // talonic_request_upload({ filename: "rental-agreement.pdf" })
2636
+ {
2637
+ "document_id": "doc_1a2b3c4d-...",
2638
+ "upload_url": "https://app.talonic.com/upload/u_abc123...",
2639
+ "expires_at": "2026-05-28T20:35:00.000Z"
2640
+ }
2641
+
2642
+ // 2. Agent: "Open this link in a new tab and drop your file:
2643
+ // https://app.talonic.com/upload/u_abc123...
2644
+ // I'll let you know once Talonic is done processing."
2645
+
2646
+ // 3. After user drops the file, agent polls:
2647
+ // talonic_get_document({ document_id: "doc_1a2b3c4d-..." })
2648
+ // \u2192 status: "processing" \u2192 wait ~10s, poll again
2649
+ // \u2192 status: "completed" \u2192 ready to extract
2650
+
2651
+ // 4. Agent extracts:
2652
+ // talonic_extract({
2653
+ // document_id: "doc_1a2b3c4d-...",
2654
+ // schema_id: "SCH-RENTAL01"
2655
+ // })
2656
+ // \u2192 structured JSON with per-field confidence scores`
2657
+ },
2658
+ {
2659
+ type: "paragraph",
2660
+ text: "The pre-allocated `document_id` is a real Talonic document from the moment the upload link is minted, but it stays in `pending` status until the user actually uploads. If the user closes the tab or the link expires (`expires_at`) without uploading, the document remains in `pending` and can be cleaned up via the dashboard. Re-issuing a fresh upload link for the same file is safe: the new link creates a new `document_id` with no link to the abandoned one."
2661
+ },
2662
+ {
2663
+ type: "paragraph",
2664
+ text: "Agents should treat the `upload_url` as user-only information and never attempt to PUT to it themselves from the sandbox. Most sandboxed environments (Claude.ai's web tools, ChatGPT's Code Interpreter) cannot reach arbitrary S3-like endpoints, and even when they can, asking the user to open the link in their own browser preserves the user-agent boundary and avoids surprising the user with a backend upload they did not consent to."
2665
+ }
2666
+ ],
2667
+ related: [
2668
+ { label: "talonic_extract", slug: "talonic-extract" },
2669
+ { label: "talonic_get_document", slug: "talonic-get-document" },
2670
+ { label: "Drag & Drop Files", slug: "drag-and-drop" },
2671
+ { label: "Known Limitations", slug: "known-limitations" }
2672
+ ],
2673
+ faq: [
2674
+ {
2675
+ question: "When should the agent use `talonic_request_upload` instead of `file_data`?",
2676
+ answer: "In hosted-connector environments (Claude.ai web, ChatGPT) where tool-call arguments are capped around ~32 KB decoded payload. Real-world documents (100 KB+) get silently truncated when sent via file_data. Local-stdio installs (Claude Desktop, Cursor, Cline, Continue, Cowork) have no such cap and can keep using file_data."
2677
+ },
2678
+ {
2679
+ question: "Does a user message like 'uploaded' mean the file is ready to extract?",
2680
+ answer: "No. That confirms only the browser-side upload finished. Server-side OCR and extraction typically need another 10\u201330 seconds. The agent must poll talonic_get_document until status is 'completed' before calling talonic_extract; calling earlier may return errors that look like the file is missing."
2681
+ },
2682
+ {
2683
+ question: "What happens if the user never opens the upload link?",
2684
+ answer: "The pre-allocated document_id remains in pending status. The expires_at timestamp indicates when the upload URL stops accepting writes \u2014 typically a short window (minutes). Past that, request a fresh link with talonic_request_upload again; the new call mints a new document_id and a new URL."
2685
+ },
2686
+ {
2687
+ question: "Can the agent PUT the file to the upload_url itself?",
2688
+ answer: "It usually cannot \u2014 Claude.ai's sandbox and similar hosted environments restrict outbound egress to arbitrary endpoints. Even where it would technically work, you should still hand the link to the user: it preserves the user-agent boundary (the user controls what file gets uploaded) and matches what every other browser-handoff flow looks like."
2689
+ },
2690
+ {
2691
+ question: "Why a separate tool instead of changing `talonic_extract`?",
2692
+ answer: "Keeping the upload-link step explicit makes the agent's reasoning visible to the user (the user sees an upload link in chat and knows what's happening). Folding it into talonic_extract would either silently change the contract for small files or introduce a hidden mode switch \u2014 both bad for predictability."
2693
+ }
2694
+ ],
2695
+ mentions: [
2696
+ "upload",
2697
+ "browser-handoff",
2698
+ "presigned URL",
2699
+ "document_id",
2700
+ "Claude.ai",
2701
+ "32 KB cap"
2702
+ ]
2484
2703
  }
2485
2704
  ];
2486
2705