@littlebigbrain/mcp 0.7.1 → 0.8.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 CHANGED
@@ -119,7 +119,7 @@ its original identifiers; inspect it with SPARQL when choosing query predicates.
119
119
  | `lbb_embeddings_manage` | Set up or refresh embeddings, or change the embedding model. |
120
120
  | `lbb_embeddings_delete` | Delete an embedding and its stored vectors. |
121
121
  | `lbb_commit` | Write or retract JSON facts, or record search feedback. |
122
- | `lbb_configure` | Define record types and relationships, or publish validation rules. |
122
+ | `lbb_configure` | Define record types and relationships, list and apply ontology starters (CRM, documents, work), or publish validation rules. |
123
123
  | `lbb_evals` | Label query results and check whether later queries return the expected answers. |
124
124
  | `lbb_models` | Compare retrieval settings and read model training datasets. |
125
125
 
@@ -353,6 +353,17 @@ export const inspectInputSchema = z.discriminatedUnion("action", [
353
353
  })
354
354
  .strict(),
355
355
  z.object({ action: z.literal("metadata"), ...readScope }).strict(),
356
+ z
357
+ .object({
358
+ action: z.literal("ontology_suggestions"),
359
+ status: z
360
+ .enum(["open", "accepted", "dismissed", "superseded"])
361
+ .optional()
362
+ .describe("Only suggestions in this state; default all"),
363
+ limit: z.number().int().min(1).max(500).optional(),
364
+ ...readScope,
365
+ })
366
+ .strict(),
356
367
  z
357
368
  .object({
358
369
  action: z.literal("entity"),
@@ -562,6 +573,80 @@ export const configureInputSchema = z.discriminatedUnion("action", [
562
573
  ...graphScope,
563
574
  })
564
575
  .strict(),
576
+ z
577
+ .object({
578
+ action: z.literal("list_starters"),
579
+ ...graphScope,
580
+ })
581
+ .strict(),
582
+ z
583
+ .object({
584
+ action: z.literal("apply_starter"),
585
+ starter: z
586
+ .string()
587
+ .min(1)
588
+ .describe("Starter id: crm, documents or work (list_starters names them)"),
589
+ dry_run: z
590
+ .boolean()
591
+ .optional()
592
+ .describe("Answer the operations applying would run, and the resulting version, without writing"),
593
+ expected_ontology_version: z
594
+ .number()
595
+ .int()
596
+ .nonnegative()
597
+ .optional()
598
+ .describe("Refuse when the graph's ontology version differs"),
599
+ ...graphScope,
600
+ })
601
+ .strict(),
602
+ z
603
+ .object({
604
+ action: z.literal("suggest_ontology_change"),
605
+ title: z
606
+ .string()
607
+ .min(1)
608
+ .max(200)
609
+ .describe("Short imperative text, e.g. 'Add class Contractor'"),
610
+ change: z
611
+ .array(ontologyEvolveOpSchema)
612
+ .min(1)
613
+ .max(64)
614
+ .describe("The ontology operations a person applies by accepting, in order (same shapes as evolve_ontology ops)"),
615
+ rationale: z
616
+ .string()
617
+ .max(4000)
618
+ .optional()
619
+ .describe("Why the ontology needs the change; cite what you saw"),
620
+ anchor: z
621
+ .object({
622
+ kind: z.enum(["ontology", "class", "property", "relation"]),
623
+ name: z.string().max(200).optional(),
624
+ })
625
+ .strict()
626
+ .optional()
627
+ .describe("The class, property or relation the change is about"),
628
+ agent: z
629
+ .string()
630
+ .max(200)
631
+ .optional()
632
+ .describe("Your name as the producer, shown to reviewers"),
633
+ key: z
634
+ .string()
635
+ .max(255)
636
+ .optional()
637
+ .describe("Idempotency key ([A-Za-z0-9-_.:/]); filing again with the same key revises the suggestion"),
638
+ evidence: z
639
+ .object({
640
+ records: z.number().int().nonnegative().optional(),
641
+ source_fields: z.array(z.string()).max(200).optional(),
642
+ samples: z.array(jsonObjectSchema).max(20).optional(),
643
+ })
644
+ .strict()
645
+ .optional()
646
+ .describe("What you saw: record count, fields, up to 20 sample records"),
647
+ ...graphScope,
648
+ })
649
+ .strict(),
565
650
  ]);
566
651
  /**
567
652
  * MCP's `registerTool` advertises a JSON Schema for an input only when the
package/dist/tools.js CHANGED
@@ -7,7 +7,7 @@ import { analyze, assertCursorScope, contentHashKey, decodeQueryCursor, effectiv
7
7
  export function registerLbbTools(server, client, options = {}) {
8
8
  registerRdfTool(server, client);
9
9
  server.registerTool("lbb_inspect", {
10
- description: "Read graph context and exact graph facts. Actions: guide, graphs, publication, ontology, ontology_conformance, schema, ontology_search, metadata, entity. graphs works before bootstrap; publication reports whether writes are queryable. ontology and schema return complete entries with page_size, section and cursor; follow next until absent. schema reads active native ontology/SHACL metadata without running validation. Query asserted RDF/OWL axioms separately with lbb_query. ontology_conformance serves the durable report referenced by the pinned published root. entity returns one node's attributes and current relationships from the RDF read. For a node's past values, run SPARQL with as_of_commit_seq through lbb_query. Use lbb_query with SPARQL property paths for precise path selection.",
10
+ description: "Read graph context and exact graph facts. Actions: guide, graphs, publication, ontology, ontology_conformance, schema, ontology_search, metadata, entity, ontology_suggestions. graphs works before bootstrap; ontology_suggestions lists the ontology change suggestions that wait for review (or were decided). publication reports whether writes are queryable. ontology and schema return complete entries with page_size, section and cursor; follow next until absent. schema reads active native ontology/SHACL metadata without running validation. Query asserted RDF/OWL axioms separately with lbb_query. ontology_conformance serves the durable report referenced by the pinned published root. entity returns one node's attributes and current relationships from the RDF read. For a node's past values, run SPARQL with as_of_commit_seq through lbb_query. Use lbb_query with SPARQL property paths for precise path selection.",
11
11
  inputSchema: inspectWireSchema,
12
12
  annotations: READ_ONLY,
13
13
  }, (rawArgs) => {
@@ -40,6 +40,11 @@ export function registerLbbTools(server, client, options = {}) {
40
40
  });
41
41
  case "metadata":
42
42
  return target.metadata();
43
+ case "ontology_suggestions":
44
+ return target.ontology.suggestions.list({
45
+ status: args.status,
46
+ limit: args.limit ?? 50,
47
+ });
43
48
  case "entity":
44
49
  return target.entityDetail({
45
50
  ...(args.entity_id
@@ -681,7 +686,7 @@ export function registerLbbTools(server, client, options = {}) {
681
686
  });
682
687
  }));
683
688
  server.registerTool("lbb_configure", {
684
- description: "Manage native schema metadata. Actions: define_ontology (friendly spec with super_types), evolve_ontology (ordered edits including add_super_types), publish_schema (SHACL activation). All support dry_run previews. Definition/import here extracts native metadata; it does NOT store the complete RDF/OWL document as queryable graph facts. Use lbb_rdf import for full OWL and lbb_rdf update for additive INSERT DATA revisions; RDF deletions are unsupported. Publish_schema accepts unchanged ontology plus shapes; use define/evolve for native ontology changes. Publication enqueues durable conformance; a preview does not validate the whole graph.",
689
+ description: "Manage native schema metadata. Actions: define_ontology (friendly spec with super_types), evolve_ontology (ordered edits including add_super_types), list_starters (the base ontologies crm, documents and work, each with its status on the graph: absent, partial or applied, what applying adds, and conflicts), apply_starter (add what the graph lacks of a starter in one ontology version; a relation the graph has is widened; refused with starter_conflict when the graph holds a term differently; dry_run previews), publish_schema (SHACL activation), suggest_ontology_change (file a change for a person to review instead of applying it; prefer it when the graph's owner reviews ontology changes, and list the result with lbb_inspect action=ontology_suggestions). define, evolve and publish support dry_run previews. Definition/import here extracts native metadata; it does NOT store the complete RDF/OWL document as queryable graph facts. Use lbb_rdf import for full OWL and lbb_rdf update for additive INSERT DATA revisions; RDF deletions are unsupported. Publish_schema accepts unchanged ontology plus shapes; use define/evolve for native ontology changes. Publication enqueues durable conformance; a preview does not validate the whole graph.",
685
690
  inputSchema: configureWireSchema,
686
691
  annotations: MUTATING,
687
692
  }, (rawArgs) => {
@@ -700,6 +705,27 @@ export function registerLbbTools(server, client, options = {}) {
700
705
  dry_run: args.dry_run,
701
706
  }));
702
707
  }
708
+ if (args.action === "suggest_ontology_change") {
709
+ const agent = args.agent ?? "mcp agent";
710
+ return scoped(client, args.graph).ontology.suggestions.create({
711
+ title: args.title,
712
+ rationale: args.rationale ?? "",
713
+ change: args.change,
714
+ origin: { kind: "agent", id: agent, label: agent },
715
+ ...(args.anchor ? { anchor: args.anchor } : {}),
716
+ ...(args.key ? { key: args.key } : {}),
717
+ ...(args.evidence ? { evidence: args.evidence } : {}),
718
+ });
719
+ }
720
+ if (args.action === "list_starters") {
721
+ return scoped(client, args.graph).ontology.starters.list();
722
+ }
723
+ if (args.action === "apply_starter") {
724
+ return scoped(client, args.graph).ontology.starters.apply(args.starter, {
725
+ dryRun: args.dry_run,
726
+ expectedOntologyVersion: args.expected_ontology_version,
727
+ });
728
+ }
703
729
  if (args.action === "evolve_ontology") {
704
730
  return scoped(client, args.graph).ontology.evolve({
705
731
  ops: args.ops,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@littlebigbrain/mcp",
3
- "version": "0.7.1",
3
+ "version": "0.8.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.15.0",
55
+ "@littlebigbrain/client": "^0.17.0",
56
56
  "@modelcontextprotocol/sdk": "^1",
57
57
  "zod": "^3"
58
58
  },