@littlebigbrain/mcp 0.13.0 → 0.14.0
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/README.md +3 -3
- package/dist/tools.js +109 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -155,9 +155,9 @@ its original identifiers; inspect it with SPARQL when choosing query predicates.
|
|
|
155
155
|
| `lbb_fit_sources` | Inspect fit from text and preview the text the fit reads. |
|
|
156
156
|
| `lbb_fit_sources_manage` | Declare, dry-run or refresh a fit source. |
|
|
157
157
|
| `lbb_fit_sources_delete` | Delete a fit source; its suggestions stay. |
|
|
158
|
-
| `lbb_workflows` | List the starter workflows this server offers and the workflows created from them on a graph (triggered workflows), read one with its status, and preview a new one. |
|
|
159
|
-
| `lbb_workflows_manage` | Create a workflow from a starter workflow on a class (a developer workflow with its workflow type, owned outputs and batch), ask it to run now, or pause and resume a developer workflow. |
|
|
160
|
-
| `lbb_workflows_delete` | Delete a triggered workflow. What it wrote stays. |
|
|
158
|
+
| `lbb_workflows` | List the starter workflows this server offers and the workflows created from them on a graph (triggered workflows), read one with its status, and preview a new one. Read the workflows with triggers (target type, shards, routing, window, trigger) and what each watch has not sent yet, with origins. |
|
|
159
|
+
| `lbb_workflows_manage` | Create a workflow from a starter workflow on a class (a developer workflow with its workflow type, owned outputs and batch), ask it to run now, or pause and resume a developer workflow. Define a workflow with triggers of your worker (shards, routing field, window) and run it now. |
|
|
160
|
+
| `lbb_workflows_delete` | Delete a triggered workflow, or a workflow with triggers by its name. What it wrote stays. |
|
|
161
161
|
| `lbb_files` | List the files of a graph, and read the parsed pages of one: each line with its id, its box on the page and its text. |
|
|
162
162
|
| `lbb_commit` | Write or retract JSON facts, or record search feedback. |
|
|
163
163
|
| `lbb_configure` | Define record types and relationships, list and apply ontology starters (CRM, documents, work), publish validation rules, or keep the graph's notes and worked examples for questions in plain words (`get_rewrite_profile`, `set_rewrite_profile`). |
|
package/dist/tools.js
CHANGED
|
@@ -613,7 +613,7 @@ export function registerLbbTools(server, client, options = {}) {
|
|
|
613
613
|
starter: z
|
|
614
614
|
.string()
|
|
615
615
|
.optional()
|
|
616
|
-
.describe("The starter workflow's catalog id from action=starters, e.g. search.embed (embeddings on a class), ontology.fit (fit from text) or workflow (a developer workflow: your worker's workflow gets the instances). get/preview/use/refresh
|
|
616
|
+
.describe("The starter workflow's catalog id from action=starters, e.g. search.embed (embeddings on a class), ontology.fit (fit from text) or workflow (a developer workflow: your worker's workflow gets the instances). get/preview/use/refresh: required. pause/resume: omit to name a workflow with triggers."),
|
|
617
617
|
class: z
|
|
618
618
|
.string()
|
|
619
619
|
.optional()
|
|
@@ -690,15 +690,90 @@ export function registerLbbTools(server, client, options = {}) {
|
|
|
690
690
|
}
|
|
691
691
|
return { starter: args.starter, name: args.name };
|
|
692
692
|
};
|
|
693
|
+
const workflowName = (args) => {
|
|
694
|
+
if (!args.name)
|
|
695
|
+
throw new Error("this action requires name");
|
|
696
|
+
return args.name;
|
|
697
|
+
};
|
|
698
|
+
// A workflow with triggers (`/v1/workflows/named`): your worker's
|
|
699
|
+
// workflow type, one watch trigger, shards, routing and window.
|
|
700
|
+
const namedSetup = {
|
|
701
|
+
shards: z
|
|
702
|
+
.number()
|
|
703
|
+
.int()
|
|
704
|
+
.min(1)
|
|
705
|
+
.max(16)
|
|
706
|
+
.optional()
|
|
707
|
+
.describe("define: engine identities that receive the messages, 1 to 16 (default 1). A change needs every shard's inbox empty."),
|
|
708
|
+
route_by: z
|
|
709
|
+
.string()
|
|
710
|
+
.optional()
|
|
711
|
+
.describe("define: a field of the class whose value keeps work in order: the changes of one value go to one shard. Default: the instance."),
|
|
712
|
+
window: z
|
|
713
|
+
.number()
|
|
714
|
+
.int()
|
|
715
|
+
.min(1)
|
|
716
|
+
.max(128)
|
|
717
|
+
.optional()
|
|
718
|
+
.describe("define: messages the watch keeps queued per shard, 1 to 128 (default 4)."),
|
|
719
|
+
trigger: z
|
|
720
|
+
.string()
|
|
721
|
+
.optional()
|
|
722
|
+
.describe("define: the watch trigger's id (default watch). queue: the trigger whose queue to read."),
|
|
723
|
+
};
|
|
724
|
+
const namedRequest = (args) => {
|
|
725
|
+
if (!args.name || !args.class || !args.workflow) {
|
|
726
|
+
throw new Error("define requires name, class and workflow");
|
|
727
|
+
}
|
|
728
|
+
return {
|
|
729
|
+
name: args.name,
|
|
730
|
+
workflow: args.workflow,
|
|
731
|
+
triggers: [
|
|
732
|
+
{
|
|
733
|
+
...(args.trigger ? { id: args.trigger } : {}),
|
|
734
|
+
watch: {
|
|
735
|
+
class: args.class,
|
|
736
|
+
...(args.fields ? { fields: args.fields } : {}),
|
|
737
|
+
},
|
|
738
|
+
},
|
|
739
|
+
],
|
|
740
|
+
...(args.owns ? { owns: args.owns } : {}),
|
|
741
|
+
...(args.batch !== undefined ? { batch: args.batch } : {}),
|
|
742
|
+
...(args.shards !== undefined ? { shards: args.shards } : {}),
|
|
743
|
+
...(args.route_by ? { route_by: args.route_by } : {}),
|
|
744
|
+
...(args.window !== undefined ? { window: args.window } : {}),
|
|
745
|
+
};
|
|
746
|
+
};
|
|
693
747
|
server.registerTool("lbb_workflows", {
|
|
694
|
-
description: "Starter workflows and triggered workflows, read only. A starter workflow is a template; a triggered workflow is a workflow created from one on the graph. It watches a class: when a published commit adds or changes instances of the class (or changes the watched fields), the workflow reads them and does its work. search.embed keeps an embedding of the class (the same as lbb_embeddings); ontology.fit reads text fields and files ontology suggestions (the same as lbb_fit_sources); workflow (a developer workflow) sends the new and changed instances to a workflow of the developer's worker as trigger messages, and that code writes the facts the workflow owns. documents.parse reads uploaded PDF files into pages with line boxes, documents.link connects mentions of the same thing across the documents (it writes DocEntry and DocMention instances and links each mention to the entry that defines or describes it), documents.map proposes each link as a FactProposal in the graph's own ontology (fact_subject, fact_predicate, fact_object, fact_confidence, fact_evidence) for a review workflow, and values.extract fills chosen properties from text, each value with a quote; read the files and their pages with lbb_files. starters lists the starter workflows this server offers with their group, settings and whether each can run here. list shows every triggered workflow of the graph with its state (backfilling, ready, paused, failed, unavailable), lag, counters, this month's spend and last error; get shows one (starter and name) with its own status in details (for workflow: the messages sent, the instances waiting, the message in flight and whether it is paused). preview shows what creating one would do (the resolved watch, the instance count and the workflow's own preview; for workflow, the first messages it would send), calls no model and stores nothing. Message workflows of the workflow engine are not listed here. Create, refresh, pause or resume with lbb_workflows_manage; delete with lbb_workflows_delete.",
|
|
748
|
+
description: "Starter workflows and triggered workflows, read only. A starter workflow is a template; a triggered workflow is a workflow created from one on the graph. It watches a class: when a published commit adds or changes instances of the class (or changes the watched fields), the workflow reads them and does its work. search.embed keeps an embedding of the class (the same as lbb_embeddings); ontology.fit reads text fields and files ontology suggestions (the same as lbb_fit_sources); workflow (a developer workflow) sends the new and changed instances to a workflow of the developer's worker as trigger messages, and that code writes the facts the workflow owns. documents.parse reads uploaded PDF files into pages with line boxes, documents.link connects mentions of the same thing across the documents (it writes DocEntry and DocMention instances and links each mention to the entry that defines or describes it), documents.map proposes each link as a FactProposal in the graph's own ontology (fact_subject, fact_predicate, fact_object, fact_confidence, fact_evidence) for a review workflow, and values.extract fills chosen properties from text, each value with a quote; read the files and their pages with lbb_files. starters lists the starter workflows this server offers with their group, settings and whether each can run here. list shows every triggered workflow of the graph with its state (backfilling, ready, paused, failed, unavailable), lag, counters, this month's spend and last error; get shows one (starter and name) with its own status in details (for workflow: the messages sent, the instances waiting, the message in flight and whether it is paused). preview shows what creating one would do (the resolved watch, the instance count and the workflow's own preview; for workflow, the first messages it would send), calls no model and stores nothing. workflows lists the same workflows as workflows with triggers (/v1/workflows/named): each one's target workflow type (LBB's own are lbb.* types), its shards (engine identities starter.<name> and starter.<name>.<k>), its routing field, its window, its one watch trigger, its status and each shard's inbox; name for one. queue (name) shows what a workflow's watch has not sent yet: each waiting instance with its shard and its origin (a backfill, a commit range with the watched fields and the requests that changed it, a run now, a schema change), the pass in progress, and per shard its message in flight and its first unfinished turns with their origins; page with after and limit. Message workflows of the workflow engine are not listed here. Create, refresh, pause or resume with lbb_workflows_manage; delete with lbb_workflows_delete.",
|
|
695
749
|
inputSchema: {
|
|
696
|
-
action: z.enum([
|
|
750
|
+
action: z.enum([
|
|
751
|
+
"starters",
|
|
752
|
+
"list",
|
|
753
|
+
"get",
|
|
754
|
+
"preview",
|
|
755
|
+
"workflows",
|
|
756
|
+
"queue",
|
|
757
|
+
]),
|
|
697
758
|
name: z
|
|
698
759
|
.string()
|
|
699
760
|
.optional()
|
|
700
|
-
.describe("get: the triggered workflow's name. preview: the name a new workflow would get."),
|
|
761
|
+
.describe("get: the triggered workflow's name. preview: the name a new workflow would get. workflows: one workflow's name (omit for all). queue: required."),
|
|
701
762
|
...workflowSetup,
|
|
763
|
+
trigger: namedSetup.trigger,
|
|
764
|
+
after: z
|
|
765
|
+
.number()
|
|
766
|
+
.int()
|
|
767
|
+
.nonnegative()
|
|
768
|
+
.optional()
|
|
769
|
+
.describe("queue: the position to start from (next_after)."),
|
|
770
|
+
limit: z
|
|
771
|
+
.number()
|
|
772
|
+
.int()
|
|
773
|
+
.min(1)
|
|
774
|
+
.max(100)
|
|
775
|
+
.optional()
|
|
776
|
+
.describe("queue: items per page, 1 to 100 (default 50)."),
|
|
702
777
|
sample: z
|
|
703
778
|
.number()
|
|
704
779
|
.int()
|
|
@@ -729,12 +804,22 @@ export function registerLbbTools(server, client, options = {}) {
|
|
|
729
804
|
...(args.sample ? { sample: args.sample } : {}),
|
|
730
805
|
...(args.iris ? { iris: args.iris } : {}),
|
|
731
806
|
});
|
|
807
|
+
case "workflows":
|
|
808
|
+
return args.name
|
|
809
|
+
? workflows.named.get(args.name)
|
|
810
|
+
: workflows.named.list();
|
|
811
|
+
case "queue":
|
|
812
|
+
return workflows.named.queue(workflowName(args), {
|
|
813
|
+
...(args.trigger ? { trigger: args.trigger } : {}),
|
|
814
|
+
...(args.after !== undefined ? { after: args.after } : {}),
|
|
815
|
+
...(args.limit !== undefined ? { limit: args.limit } : {}),
|
|
816
|
+
});
|
|
732
817
|
}
|
|
733
818
|
}));
|
|
734
819
|
server.registerTool("lbb_workflows_manage", {
|
|
735
|
-
description: "Create a workflow from a starter workflow, or refresh, pause or resume a triggered workflow. Run lbb_workflows action=preview first and show the user the watch and the instance count. use creates a workflow from a starter workflow of action=starters, under a name (default: the class's local name), with its watch (class, fields) and params; the workflow then reads every instance of the class and follows each published commit. A developer workflow (starter=workflow) also takes workflow (workflow_type and version of the developer's worker), owns and batch; it needs a server with the workflow engine. use again with the same starter and name changes only what you name, and the same request again changes nothing. A workflow that calls models (ontology.fit, documents.link, documents.map, values.extract) spends model budget as it reads. refresh asks the workflow to run now and returns at once with queued; poll lbb_workflows action=get for progress. pause stops a workflow (a developer workflow, documents.parse, documents.link, documents.map or values.extract) from reading and sending; resume lets it catch up. search.embed and ontology.fit cannot be paused.",
|
|
820
|
+
description: "Create a workflow from a starter workflow, or refresh, pause or resume a triggered workflow. Run lbb_workflows action=preview first and show the user the watch and the instance count. use creates a workflow from a starter workflow of action=starters, under a name (default: the class's local name), with its watch (class, fields) and params; the workflow then reads every instance of the class and follows each published commit. A developer workflow (starter=workflow) also takes workflow (workflow_type and version of the developer's worker), owns and batch; it needs a server with the workflow engine. use again with the same starter and name changes only what you name, and the same request again changes nothing. A workflow that calls models (ontology.fit, documents.link, documents.map, values.extract) spends model budget as it reads. refresh asks the workflow to run now and returns at once with queued; poll lbb_workflows action=get for progress. pause stops a workflow (a developer workflow, documents.parse, documents.link, documents.map or values.extract) from reading and sending, and stops the claims of a developer workflow's shards; resume lets it catch up. Without starter, pause and resume name a workflow with triggers. search.embed and ontology.fit cannot be paused. define creates or changes a workflow with triggers of the developer's worker (/v1/workflows/named): name, workflow, class and fields (its watch trigger), owns, batch, and shards (engine identities, 1 to 16), route_by (a field that keeps work in order) and window (messages queued per shard, default 4); it needs a server with the workflow engine, and a change of shards waits for empty inboxes. run (name) runs a workflow with triggers now: its watch sends every instance again.",
|
|
736
821
|
inputSchema: {
|
|
737
|
-
action: z.enum(["use", "refresh", "pause", "resume"]),
|
|
822
|
+
action: z.enum(["use", "refresh", "pause", "resume", "define", "run"]),
|
|
738
823
|
name: z
|
|
739
824
|
.string()
|
|
740
825
|
.optional()
|
|
@@ -751,6 +836,7 @@ export function registerLbbTools(server, client, options = {}) {
|
|
|
751
836
|
.nonnegative()
|
|
752
837
|
.optional()
|
|
753
838
|
.describe("use: a monthly model budget in USD for this workflow, below the stack's own."),
|
|
839
|
+
...namedSetup,
|
|
754
840
|
detail: detailSchema,
|
|
755
841
|
...graphScope,
|
|
756
842
|
},
|
|
@@ -763,17 +849,26 @@ export function registerLbbTools(server, client, options = {}) {
|
|
|
763
849
|
case "refresh":
|
|
764
850
|
return workflows.triggered.refresh(workflowRef(args));
|
|
765
851
|
case "pause":
|
|
766
|
-
return
|
|
852
|
+
return args.starter
|
|
853
|
+
? workflows.triggered.pause(workflowRef(args), true)
|
|
854
|
+
: workflows.named.pause(workflowName(args), true);
|
|
767
855
|
case "resume":
|
|
768
|
-
return
|
|
856
|
+
return args.starter
|
|
857
|
+
? workflows.triggered.pause(workflowRef(args), false)
|
|
858
|
+
: workflows.named.pause(workflowName(args), false);
|
|
859
|
+
case "define":
|
|
860
|
+
return workflows.named.put(namedRequest(args));
|
|
861
|
+
case "run":
|
|
862
|
+
return workflows.named.run(workflowName(args));
|
|
769
863
|
}
|
|
770
864
|
}));
|
|
771
865
|
server.registerTool("lbb_workflows_delete", {
|
|
772
|
-
description: "Delete a triggered workflow: it stops following its class, and what it wrote stays. Deleting search.embed deletes the embedding and its vectors, so its class stops being searchable; the suggestions an ontology.fit filed stay; a developer workflow leaves its workflow instance and the facts its code wrote. Ask the user first; confirm must repeat the name.",
|
|
866
|
+
description: "Delete a triggered workflow: it stops following its class, and what it wrote stays. Deleting search.embed deletes the embedding and its vectors, so its class stops being searchable; the suggestions an ontology.fit filed stay; a developer workflow leaves its workflow instance and the facts its code wrote. Without starter it deletes a workflow with triggers by its name, and its shards stay. Ask the user first; confirm must repeat the name.",
|
|
773
867
|
inputSchema: {
|
|
774
868
|
starter: z
|
|
775
869
|
.string()
|
|
776
|
-
.
|
|
870
|
+
.optional()
|
|
871
|
+
.describe("The starter workflow's catalog id, e.g. search.embed. Omit for a workflow with triggers."),
|
|
777
872
|
name: z.string().describe("The triggered workflow's name."),
|
|
778
873
|
confirm: z.string().describe("The same name again, to confirm."),
|
|
779
874
|
detail: detailSchema,
|
|
@@ -784,10 +879,10 @@ export function registerLbbTools(server, client, options = {}) {
|
|
|
784
879
|
if (confirm !== name) {
|
|
785
880
|
throw new Error("confirm must repeat the workflow name");
|
|
786
881
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
name
|
|
790
|
-
|
|
882
|
+
const workflows = scoped(client, graph).workflows;
|
|
883
|
+
return starter
|
|
884
|
+
? workflows.triggered.delete({ starter, name })
|
|
885
|
+
: workflows.named.delete(name);
|
|
791
886
|
}));
|
|
792
887
|
const modelUse = z
|
|
793
888
|
.enum(["ask", "route", "rerank", "fit", "label"])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@littlebigbrain/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "MCP server for little big brain: search, graph queries, and data import",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"test:coverage": "npm run clean:test && tsc -p tsconfig.test.json && node --test --experimental-test-coverage --test-coverage-include=test-dist/*.js --test-coverage-exclude=test-dist/*.test.js --test-coverage-exclude=test-dist/stdio.js --test-coverage-exclude=test-dist/test-support.js --test-coverage-lines=90 --test-coverage-branches=70 --test-coverage-functions=85 \"test-dist/**/*.test.js\""
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@littlebigbrain/client": "^0.
|
|
55
|
+
"@littlebigbrain/client": "^0.26.0",
|
|
56
56
|
"@modelcontextprotocol/sdk": "^1",
|
|
57
57
|
"zod": "^3"
|
|
58
58
|
},
|