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