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