@talonic/mcp 0.1.22 → 0.1.24
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 +116 -31
- package/dist/http-server.js.map +1 -1
- package/dist/index.js +116 -31
- package/dist/index.js.map +1 -1
- package/dist/server.js +116 -31
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
package/dist/server.js
CHANGED
|
@@ -271,7 +271,16 @@ var outputSchema = {
|
|
|
271
271
|
document: z.string().optional(),
|
|
272
272
|
dashboard: z.string().optional()
|
|
273
273
|
}).optional().describe("URLs for self, document, and human-readable dashboard view."),
|
|
274
|
-
markdown: z.string().optional().describe("OCR-converted markdown. Present only when `include_markdown: true`.")
|
|
274
|
+
markdown: z.string().optional().describe("OCR-converted markdown. Present only when `include_markdown: true`."),
|
|
275
|
+
cost: z.object({
|
|
276
|
+
costCredits: z.number().describe("Credits consumed by this call."),
|
|
277
|
+
costEur: z.number().describe("Approximate EUR cost of this call."),
|
|
278
|
+
balanceCredits: z.number().describe("Workspace credit balance after this call settled."),
|
|
279
|
+
cellsResolvedRegistry: z.number().describe("Cells resolved from the materialized field-registry (cheap path)."),
|
|
280
|
+
cellsResolvedAi: z.number().describe("Cells resolved by AI extraction (priced path).")
|
|
281
|
+
}).nullable().optional().describe(
|
|
282
|
+
"Per-call cost and post-call balance, parsed from the X-Talonic-* response headers. `null` for non-extract calls; not always present on legacy clients."
|
|
283
|
+
)
|
|
275
284
|
};
|
|
276
285
|
async function handleExtract(talonic, args) {
|
|
277
286
|
if (args.schema === void 0 && args.schema_id === void 0) {
|
|
@@ -459,6 +468,70 @@ function registerFilter(server, getTalonic) {
|
|
|
459
468
|
);
|
|
460
469
|
}
|
|
461
470
|
var DESCRIPTION3 = [
|
|
471
|
+
"STATUS: stable.",
|
|
472
|
+
"",
|
|
473
|
+
"Read the user's current Talonic credit balance, EUR value, 30-day burn rate,",
|
|
474
|
+
"projected runway, tier, and next-tier-reset timestamp. Use this to make budget-",
|
|
475
|
+
"aware decisions before kicking off large batches or re-extractions.",
|
|
476
|
+
"",
|
|
477
|
+
"USE WHEN:",
|
|
478
|
+
"- The user asks how many credits or how much budget they have left.",
|
|
479
|
+
"- You are about to run a large or expensive operation (batch extract, re-extract",
|
|
480
|
+
" many documents) and want to confirm budget headroom first.",
|
|
481
|
+
"- The user asks how long their balance will last at the current rate.",
|
|
482
|
+
"",
|
|
483
|
+
"DO NOT USE WHEN:",
|
|
484
|
+
"- The user just wants the per-call cost of a single extraction (that is already",
|
|
485
|
+
" on the talonic_extract response under `cost`).",
|
|
486
|
+
"- The user wants to top up credits (route them to the dashboard; auto top-up is",
|
|
487
|
+
" guarded by a separate scope).",
|
|
488
|
+
"",
|
|
489
|
+
"RESPONSE SHAPE:",
|
|
490
|
+
"- balance_credits: current credit balance.",
|
|
491
|
+
"- balance_eur: current balance in EUR (rounded to two decimals).",
|
|
492
|
+
"- burn_rate_30d_credits: total credits consumed in the trailing 30 days.",
|
|
493
|
+
"- projected_runway_days: days of runway at the current 30-day average burn.",
|
|
494
|
+
" `-1` indicates no consumption in the trailing window (cannot compute runway).",
|
|
495
|
+
"- tier: API tier of the workspace (`free`, `pro`, `enterprise`, etc.).",
|
|
496
|
+
"- tier_resets_at: ISO 8601 timestamp of the next monthly tier reset."
|
|
497
|
+
].join("\n");
|
|
498
|
+
var inputSchema3 = {};
|
|
499
|
+
var outputSchema3 = {
|
|
500
|
+
balance_credits: z.number().describe("Current credit balance."),
|
|
501
|
+
balance_eur: z.number().describe("Current balance in EUR (two decimals)."),
|
|
502
|
+
burn_rate_30d_credits: z.number().describe("Total credits consumed in the trailing 30 days."),
|
|
503
|
+
projected_runway_days: z.number().describe(
|
|
504
|
+
"Projected days of runway at the current 30-day average burn. `-1` when burn is zero (cannot compute)."
|
|
505
|
+
),
|
|
506
|
+
tier: z.string().describe("API tier of the workspace."),
|
|
507
|
+
tier_resets_at: z.string().describe("ISO 8601 timestamp of the next monthly tier reset.")
|
|
508
|
+
};
|
|
509
|
+
async function handleGetBalance(talonic) {
|
|
510
|
+
try {
|
|
511
|
+
const result = await talonic.credits.getBalance();
|
|
512
|
+
return jsonOk(result);
|
|
513
|
+
} catch (err) {
|
|
514
|
+
return toolError(err);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
function registerGetBalance(server, getTalonic) {
|
|
518
|
+
server.registerTool(
|
|
519
|
+
"talonic_get_balance",
|
|
520
|
+
{
|
|
521
|
+
title: "Get Talonic Credit Balance",
|
|
522
|
+
description: DESCRIPTION3,
|
|
523
|
+
inputSchema: inputSchema3,
|
|
524
|
+
outputSchema: outputSchema3,
|
|
525
|
+
annotations: {
|
|
526
|
+
title: "Get Talonic Credit Balance",
|
|
527
|
+
readOnlyHint: true,
|
|
528
|
+
openWorldHint: true
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
async () => handleGetBalance(getTalonic())
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
var DESCRIPTION4 = [
|
|
462
535
|
"STATUS: stable.",
|
|
463
536
|
"",
|
|
464
537
|
"Fetch full metadata for a single document already in the user's Talonic workspace.",
|
|
@@ -475,12 +548,12 @@ var DESCRIPTION3 = [
|
|
|
475
548
|
"- The user wants extracted structured data (use talonic_extract with a schema, or fetch the extraction by id).",
|
|
476
549
|
"- The user has a file but no document_id yet (call talonic_extract first to ingest the document)."
|
|
477
550
|
].join("\n");
|
|
478
|
-
var
|
|
551
|
+
var inputSchema4 = {
|
|
479
552
|
document_id: z.string().min(1).describe(
|
|
480
553
|
"The Talonic document ID. Get this from a previous talonic_extract or talonic_search response."
|
|
481
554
|
)
|
|
482
555
|
};
|
|
483
|
-
var
|
|
556
|
+
var outputSchema4 = {
|
|
484
557
|
id: z.string(),
|
|
485
558
|
filename: z.string().optional(),
|
|
486
559
|
pages: z.number().optional(),
|
|
@@ -535,9 +608,9 @@ function registerGetDocument(server, getTalonic) {
|
|
|
535
608
|
"talonic_get_document",
|
|
536
609
|
{
|
|
537
610
|
title: "Get Talonic Document",
|
|
538
|
-
description:
|
|
539
|
-
inputSchema:
|
|
540
|
-
outputSchema:
|
|
611
|
+
description: DESCRIPTION4,
|
|
612
|
+
inputSchema: inputSchema4,
|
|
613
|
+
outputSchema: outputSchema4,
|
|
541
614
|
annotations: {
|
|
542
615
|
title: "Get Talonic Document",
|
|
543
616
|
readOnlyHint: true,
|
|
@@ -547,7 +620,7 @@ function registerGetDocument(server, getTalonic) {
|
|
|
547
620
|
async (args) => handleGetDocument(getTalonic(), args)
|
|
548
621
|
);
|
|
549
622
|
}
|
|
550
|
-
var
|
|
623
|
+
var DESCRIPTION5 = [
|
|
551
624
|
"STATUS: stable.",
|
|
552
625
|
"",
|
|
553
626
|
"List all saved schemas in the user's Talonic workspace.",
|
|
@@ -584,7 +657,7 @@ var schemaItem = z.object({
|
|
|
584
657
|
dashboard: z.string().optional()
|
|
585
658
|
}).optional()
|
|
586
659
|
});
|
|
587
|
-
var
|
|
660
|
+
var outputSchema5 = {
|
|
588
661
|
data: z.array(schemaItem).describe("Saved schemas in the workspace."),
|
|
589
662
|
pagination: z.object({
|
|
590
663
|
total: z.number().optional(),
|
|
@@ -606,9 +679,9 @@ function registerListSchemas(server, getTalonic) {
|
|
|
606
679
|
"talonic_list_schemas",
|
|
607
680
|
{
|
|
608
681
|
title: "List Talonic Schemas",
|
|
609
|
-
description:
|
|
682
|
+
description: DESCRIPTION5,
|
|
610
683
|
inputSchema: {},
|
|
611
|
-
outputSchema:
|
|
684
|
+
outputSchema: outputSchema5,
|
|
612
685
|
annotations: {
|
|
613
686
|
title: "List Talonic Schemas",
|
|
614
687
|
readOnlyHint: true,
|
|
@@ -618,7 +691,7 @@ function registerListSchemas(server, getTalonic) {
|
|
|
618
691
|
async () => handleListSchemas(getTalonic())
|
|
619
692
|
);
|
|
620
693
|
}
|
|
621
|
-
var
|
|
694
|
+
var DESCRIPTION6 = [
|
|
622
695
|
"STATUS: stable.",
|
|
623
696
|
"",
|
|
624
697
|
"Save a schema definition to the user's Talonic workspace so it can be reused",
|
|
@@ -639,14 +712,14 @@ var DESCRIPTION5 = [
|
|
|
639
712
|
"",
|
|
640
713
|
"TIP: After saving, call talonic_extract with `schema_id` set to the returned id (UUID or SCH- short id) for consistent results."
|
|
641
714
|
].join("\n");
|
|
642
|
-
var
|
|
715
|
+
var inputSchema5 = {
|
|
643
716
|
name: z.string().min(1).describe("Human-readable name for the schema, e.g. 'Standard Invoice'."),
|
|
644
717
|
definition: z.record(z.string(), z.unknown()).describe(
|
|
645
718
|
"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."
|
|
646
719
|
),
|
|
647
720
|
description: z.string().optional().describe("Optional description of what this schema extracts and when to use it.")
|
|
648
721
|
};
|
|
649
|
-
var
|
|
722
|
+
var outputSchema6 = {
|
|
650
723
|
id: z.string().describe("UUID of the newly saved schema."),
|
|
651
724
|
short_id: z.string().optional().describe("Human-readable short id (SCH-XXXXXXXX)."),
|
|
652
725
|
name: z.string(),
|
|
@@ -681,9 +754,9 @@ function registerSaveSchema(server, getTalonic) {
|
|
|
681
754
|
"talonic_save_schema",
|
|
682
755
|
{
|
|
683
756
|
title: "Save Talonic Schema",
|
|
684
|
-
description:
|
|
685
|
-
inputSchema:
|
|
686
|
-
outputSchema:
|
|
757
|
+
description: DESCRIPTION6,
|
|
758
|
+
inputSchema: inputSchema5,
|
|
759
|
+
outputSchema: outputSchema6,
|
|
687
760
|
annotations: {
|
|
688
761
|
title: "Save Talonic Schema",
|
|
689
762
|
readOnlyHint: false,
|
|
@@ -694,7 +767,7 @@ function registerSaveSchema(server, getTalonic) {
|
|
|
694
767
|
async (args) => handleSaveSchema(getTalonic(), args)
|
|
695
768
|
);
|
|
696
769
|
}
|
|
697
|
-
var
|
|
770
|
+
var DESCRIPTION7 = [
|
|
698
771
|
"STATUS: stable.",
|
|
699
772
|
"",
|
|
700
773
|
"Search the user's Talonic workspace for documents, fields, sources, or schemas",
|
|
@@ -716,13 +789,13 @@ var DESCRIPTION6 = [
|
|
|
716
789
|
"filterable: true can be used with talonic_filter. Fields with filterable: false exist",
|
|
717
790
|
"in a schema but have no extracted data yet. Pick the entity type the user actually needs."
|
|
718
791
|
].join("\n");
|
|
719
|
-
var
|
|
792
|
+
var inputSchema6 = {
|
|
720
793
|
query: z.string().min(1).describe(
|
|
721
794
|
"Natural-language search query, e.g. 'indemnification clauses' or 'Acme invoices Q4'."
|
|
722
795
|
),
|
|
723
796
|
limit: z.number().int().positive().optional().describe("Maximum results per entity type. Default: 5. Increase for broader exploration.")
|
|
724
797
|
};
|
|
725
|
-
var
|
|
798
|
+
var outputSchema7 = {
|
|
726
799
|
documents: z.array(
|
|
727
800
|
z.object({
|
|
728
801
|
id: z.string(),
|
|
@@ -746,7 +819,9 @@ var outputSchema6 = {
|
|
|
746
819
|
schemas: z.array(z.object({ id: z.string(), name: z.string().optional() })).describe("Saved schemas matching the query."),
|
|
747
820
|
fields: z.array(
|
|
748
821
|
z.object({
|
|
749
|
-
id: z.string()
|
|
822
|
+
id: z.string().nullable().describe(
|
|
823
|
+
"Field UUID for materialized field-registry entries; `null` for schema-only fields that are declared in a schema but have no extracted values yet. Always non-null when `filterable: true`."
|
|
824
|
+
),
|
|
750
825
|
canonicalName: z.string().optional(),
|
|
751
826
|
displayName: z.string().optional(),
|
|
752
827
|
documentCount: z.number().optional(),
|
|
@@ -772,9 +847,9 @@ function registerSearch(server, getTalonic) {
|
|
|
772
847
|
"talonic_search",
|
|
773
848
|
{
|
|
774
849
|
title: "Search Talonic Workspace",
|
|
775
|
-
description:
|
|
776
|
-
inputSchema:
|
|
777
|
-
outputSchema:
|
|
850
|
+
description: DESCRIPTION7,
|
|
851
|
+
inputSchema: inputSchema6,
|
|
852
|
+
outputSchema: outputSchema7,
|
|
778
853
|
annotations: {
|
|
779
854
|
title: "Search Talonic Workspace",
|
|
780
855
|
readOnlyHint: true,
|
|
@@ -784,7 +859,7 @@ function registerSearch(server, getTalonic) {
|
|
|
784
859
|
async (args) => handleSearch(getTalonic(), args)
|
|
785
860
|
);
|
|
786
861
|
}
|
|
787
|
-
var
|
|
862
|
+
var DESCRIPTION8 = [
|
|
788
863
|
"STATUS: stable.",
|
|
789
864
|
"",
|
|
790
865
|
"Get the OCR-converted markdown for a document. Accepts an existing document_id,",
|
|
@@ -814,7 +889,7 @@ var DESCRIPTION7 = [
|
|
|
814
889
|
"- file_url: a URL the Talonic API will fetch directly. Use for documents already on the",
|
|
815
890
|
" public web. Best path for Claude.ai users dealing with files larger than the parameter cap."
|
|
816
891
|
].join("\n");
|
|
817
|
-
var
|
|
892
|
+
var inputSchema7 = {
|
|
818
893
|
document_id: z.string().min(1).optional().describe(
|
|
819
894
|
"The Talonic document id whose markdown you want. Get this from a previous talonic_extract or talonic_search response."
|
|
820
895
|
),
|
|
@@ -829,9 +904,18 @@ var inputSchema6 = {
|
|
|
829
904
|
),
|
|
830
905
|
file_url: z.string().optional().describe("URL to a document file. The Talonic API fetches it server-side.")
|
|
831
906
|
};
|
|
832
|
-
var
|
|
907
|
+
var outputSchema8 = {
|
|
833
908
|
document_id: z.string().describe("ID of the document the markdown was extracted from."),
|
|
834
|
-
markdown: z.string().describe("OCR-converted markdown text content of the document.")
|
|
909
|
+
markdown: z.string().describe("OCR-converted markdown text content of the document."),
|
|
910
|
+
cost: z.object({
|
|
911
|
+
costCredits: z.number(),
|
|
912
|
+
costEur: z.number(),
|
|
913
|
+
balanceCredits: z.number(),
|
|
914
|
+
cellsResolvedRegistry: z.number(),
|
|
915
|
+
cellsResolvedAi: z.number()
|
|
916
|
+
}).nullable().optional().describe(
|
|
917
|
+
"Per-call cost and post-call balance from the underlying extract step, parsed from the X-Talonic-* response headers. `null` when the document was already ingested (document_id path) and no extract call ran. Not always present on legacy clients."
|
|
918
|
+
)
|
|
835
919
|
};
|
|
836
920
|
var INGEST_ONLY_SCHEMA = {
|
|
837
921
|
type: "object",
|
|
@@ -883,9 +967,9 @@ function registerToMarkdown(server, getTalonic) {
|
|
|
883
967
|
"talonic_to_markdown",
|
|
884
968
|
{
|
|
885
969
|
title: "Document to Markdown",
|
|
886
|
-
description:
|
|
887
|
-
inputSchema:
|
|
888
|
-
outputSchema:
|
|
970
|
+
description: DESCRIPTION8,
|
|
971
|
+
inputSchema: inputSchema7,
|
|
972
|
+
outputSchema: outputSchema8,
|
|
889
973
|
annotations: {
|
|
890
974
|
title: "Document to Markdown",
|
|
891
975
|
readOnlyHint: false,
|
|
@@ -899,7 +983,7 @@ function registerToMarkdown(server, getTalonic) {
|
|
|
899
983
|
|
|
900
984
|
// package.json
|
|
901
985
|
var package_default = {
|
|
902
|
-
version: "0.1.
|
|
986
|
+
version: "0.1.24"};
|
|
903
987
|
|
|
904
988
|
// src/version.ts
|
|
905
989
|
var VERSION = package_default.version;
|
|
@@ -969,6 +1053,7 @@ function createServer(options) {
|
|
|
969
1053
|
registerFilter(server, getTalonic);
|
|
970
1054
|
registerToMarkdown(server, getTalonic);
|
|
971
1055
|
registerExtract(server, getTalonic);
|
|
1056
|
+
registerGetBalance(server, getTalonic);
|
|
972
1057
|
registerSchemasResource(server, getTalonic);
|
|
973
1058
|
registerWebhooksResource(server, getToken, baseUrl);
|
|
974
1059
|
return server;
|