@littlebigbrain/mcp 0.2.7 → 0.3.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 +2 -2
- package/dist/tool-contracts.js +0 -12
- package/dist/tool-runtime.js +2 -2
- package/dist/tools.js +4 -37
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -58,10 +58,10 @@ missing.
|
|
|
58
58
|
|
|
59
59
|
| Tool | Use it for |
|
|
60
60
|
| --- | --- |
|
|
61
|
-
| `lbb_search` | hybrid retrieval, multi-query fusion,
|
|
61
|
+
| `lbb_search` | hybrid retrieval, multi-query fusion, and semantic graph results |
|
|
62
62
|
| `lbb_decode` | constrained relation decoding |
|
|
63
63
|
| `lbb_ground` | vocabulary completion and resolution |
|
|
64
|
-
| `lbb_inspect` | ontology, schema, entity, state, history, provenance
|
|
64
|
+
| `lbb_inspect` | ontology, schema, entity, state, history, and provenance |
|
|
65
65
|
| `lbb_query` | SPARQL and structured analytics |
|
|
66
66
|
| `lbb_commit` | facts, properties, and embeddings |
|
|
67
67
|
| `lbb_observe` | conversation episodes plus reviewed extraction |
|
package/dist/tool-contracts.js
CHANGED
|
@@ -358,18 +358,6 @@ export const inspectInputSchema = z.discriminatedUnion("action", [
|
|
|
358
358
|
...readScope,
|
|
359
359
|
})
|
|
360
360
|
.strict(),
|
|
361
|
-
z
|
|
362
|
-
.object({
|
|
363
|
-
action: z.literal("traverse"),
|
|
364
|
-
entity_type: z.string(),
|
|
365
|
-
name: z.string(),
|
|
366
|
-
relations: z.array(z.string()).optional(),
|
|
367
|
-
direction: z.enum(["out", "in", "both"]).optional(),
|
|
368
|
-
max_hops: z.number().int().positive().max(6).optional(),
|
|
369
|
-
top_k: z.number().int().positive().optional(),
|
|
370
|
-
...readScope,
|
|
371
|
-
})
|
|
372
|
-
.strict(),
|
|
373
361
|
z
|
|
374
362
|
.object({
|
|
375
363
|
action: z.literal("transitions"),
|
package/dist/tool-runtime.js
CHANGED
|
@@ -754,9 +754,9 @@ export async function guide(scopedClient) {
|
|
|
754
754
|
entity_types: entityTypes,
|
|
755
755
|
relations,
|
|
756
756
|
capability: {
|
|
757
|
-
search: "Use lbb_search for natural-language retrieval
|
|
757
|
+
search: "Use lbb_search for natural-language retrieval and optional multi-query fusion. Semantic graph search may include internally scored paths in its result set.",
|
|
758
758
|
search_feedback: "After a lbb_search result set is useful or clearly wrong, write relevance labels with lbb_commit mode=search_feedback. Use grade 3 for ideal/good results, grade 1 for partially relevant results, and grade 0 for bad results. Include the original query, search_id when present, target identity, rank, score, and an optional split train/eval/unspecified. These labels are stored in __lbb_feedback/main and later exported as qrels-style training/eval data; they are not customer facts.",
|
|
759
|
-
inspect: "Use lbb_inspect for ontology, schema metadata, the published conformance report, metadata, state/history/why,
|
|
759
|
+
inspect: "Use lbb_inspect for ontology, schema metadata, the published conformance report, metadata, state/history/why, and this guide. Use lbb_query with SPARQL property paths for exact path queries.",
|
|
760
760
|
ontology_decorations: "lbb_inspect action=ontology returns a decoration_status catalog: each ontology decoration is enforced (the engine acts on it — state_reducer, value_type, super_types, properties, supernode_policy; cardinality, which GET /v1/ontology/conformance audits as sh:maxCount; and inverse_name/symmetric, which SPARQL resolves as relation aliases — an inverse name is queryable directly (lowered to ^forward, no stored inverse triple) and a symmetric relation matches both directions), advisory (transitive, temporal_semantics, required), or reserved (stored but unwired — default_weight, resolvable, alias/embedding_fields). You can also always reverse any relation in SPARQL by flipping the triple pattern or using ^forward. Each relation_def also carries edge_count — the number of current edges of that relation in this branch's snapshot — so you can tell at a glance which declared relations are actually populated (edge_count 0 = declared but unused) without a separate summary call.",
|
|
761
761
|
query: "Use lbb_query for structured SPARQL-subset bodies, SPARQL text, and canned analysis. A mode=structured body is { patterns: [{ subject, predicate, object }], filters?, group_by?, group_keys?, aggregates?, having? }; a pattern `predicate` is a relation name and is case-insensitive. mode=structured GROUP BY is not limited to entity identity: group_keys can key on a typed scalar property or calendar bucket. In SPARQL text, relations are <https://littlebigbrain.com/r/NAME> and types <https://littlebigbrain.com/class/NAME>. Each query pins one published watermark.",
|
|
762
762
|
write: "Use lbb_commit for fact writes and search relevance feedback; omitted idempotency keys are content-derived so retries dedupe. Set typed scalar attributes via entity_properties once the field is registered (add it on a live graph with lbb_configure evolve_ontology add_property). For feedback, use mode=search_feedback rather than fact triplets.",
|
package/dist/tools.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { IDEMPOTENT_WRITE, MUTATING, READ_ONLY, configureInputSchema, configureWireSchema, detailSchema, graphScope, inspectInputSchema, inspectWireSchema, jsonObjectSchema, queryInputSchema, queryWireSchema, searchFeedbackSchema, } from "./tool-contracts.js";
|
|
3
|
-
import { analyze, assertCursorScope, contentHashKey, decodeQueryCursor, effectiveRowLimit, enrichError, errorResult, guide, normalizeDetail, normalizeLbbIris, ontologyDefineBody, queryCommitPin, queryEnvelope, requireString,
|
|
3
|
+
import { analyze, assertCursorScope, contentHashKey, decodeQueryCursor, effectiveRowLimit, enrichError, errorResult, guide, normalizeDetail, normalizeLbbIris, ontologyDefineBody, queryCommitPin, queryEnvelope, requireString, rowPageFrom, rowPageNext, run, scoped, searchBody, searchFeedbackHint, stableJson, toolResult, } from "./tool-runtime.js";
|
|
4
4
|
export function registerLbbTools(server, client) {
|
|
5
5
|
server.registerTool("lbb_search", {
|
|
6
|
-
description: "Natural-language retrieval over Little Big Brain. Use `query` for one phrasing
|
|
6
|
+
description: "Natural-language retrieval over Little Big Brain. Use `query` for one phrasing or `queries` for reciprocal-rank fusion across phrasings. Semantic graph search can return internally scored paths alongside entity and assertion results. When you can judge returned results, call lbb_commit mode=search_feedback with good=3, partial=1, bad=0 so Little Big Brain can build customer-specific qrels for embedding training.",
|
|
7
7
|
inputSchema: {
|
|
8
8
|
query: z.string().optional().describe("Natural-language query"),
|
|
9
9
|
queries: z
|
|
@@ -12,10 +12,7 @@ export function registerLbbTools(server, client) {
|
|
|
12
12
|
.optional()
|
|
13
13
|
.describe("Multiple phrasings to fuse"),
|
|
14
14
|
mode: z.enum(["hybrid", "bm25", "vector", "lexical"]).optional(),
|
|
15
|
-
follow_paths: z.boolean().optional(),
|
|
16
15
|
top_k: z.number().int().positive().optional(),
|
|
17
|
-
max_hops: z.number().int().positive().max(6).optional(),
|
|
18
|
-
direction: z.enum(["out", "in", "both"]).optional(),
|
|
19
16
|
profile: z
|
|
20
17
|
.enum(["ndcg_v1", "graph_aware_v1", "baseline", "scored_atom_v1"])
|
|
21
18
|
.optional(),
|
|
@@ -33,7 +30,7 @@ export function registerLbbTools(server, client) {
|
|
|
33
30
|
...graphScope,
|
|
34
31
|
},
|
|
35
32
|
annotations: READ_ONLY,
|
|
36
|
-
}, ({ query, queries, mode,
|
|
33
|
+
}, ({ query, queries, mode, top_k, profile, as_of, as_of_commit_seq, detail, graph, branch, }) => run(client, "lbb_search", detail, () => {
|
|
37
34
|
const target = scoped(client, graph, branch);
|
|
38
35
|
if (queries?.length) {
|
|
39
36
|
return target.multiSearch({
|
|
@@ -54,24 +51,6 @@ export function registerLbbTools(server, client) {
|
|
|
54
51
|
});
|
|
55
52
|
}
|
|
56
53
|
const q = requireString(query, "query");
|
|
57
|
-
if (follow_paths) {
|
|
58
|
-
return target.semanticTraverse({
|
|
59
|
-
query: q,
|
|
60
|
-
seed_top_k: Math.min(top_k ?? 3, 10),
|
|
61
|
-
search: {
|
|
62
|
-
lexical: true,
|
|
63
|
-
bm25: true,
|
|
64
|
-
vector: true,
|
|
65
|
-
consistency: "strong",
|
|
66
|
-
profile: resolveProfile(profile),
|
|
67
|
-
},
|
|
68
|
-
direction: direction ?? "both",
|
|
69
|
-
max_hops: max_hops ?? 2,
|
|
70
|
-
max_frontier_entities: 50,
|
|
71
|
-
max_paths: top_k ?? 25,
|
|
72
|
-
explain: false,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
54
|
return target.graphSearch(searchBody({
|
|
76
55
|
query: q,
|
|
77
56
|
mode,
|
|
@@ -168,7 +147,7 @@ export function registerLbbTools(server, client) {
|
|
|
168
147
|
});
|
|
169
148
|
}));
|
|
170
149
|
server.registerTool("lbb_inspect", {
|
|
171
|
-
description: "Read graph context and exact graph facts. Actions: guide, ontology, ontology_conformance, schema, ontology_search, metadata, entity, state, history, transitions, why
|
|
150
|
+
description: "Read graph context and exact graph facts. Actions: guide, ontology, ontology_conformance, schema, ontology_search, metadata, entity, state, history, transitions, why. schema reads active ontology/SHACL bundle metadata without running validation. ontology_conformance serves the durable report referenced by the pinned published root. entity returns one node's metadata, scalar attributes, bounded Base-backed edge neighborhood, history, and observations. Use lbb_query with SPARQL property paths for precise path selection.",
|
|
172
151
|
inputSchema: inspectWireSchema,
|
|
173
152
|
annotations: READ_ONLY,
|
|
174
153
|
}, (rawArgs) => {
|
|
@@ -239,18 +218,6 @@ export function registerLbbTools(server, client) {
|
|
|
239
218
|
name: args.target_name,
|
|
240
219
|
},
|
|
241
220
|
});
|
|
242
|
-
case "traverse":
|
|
243
|
-
return target.traverse({
|
|
244
|
-
start: {
|
|
245
|
-
entity_type: args.entity_type,
|
|
246
|
-
name: args.name,
|
|
247
|
-
},
|
|
248
|
-
relations: args.relations ?? null,
|
|
249
|
-
direction: args.direction ?? "both",
|
|
250
|
-
max_hops: args.max_hops ?? 2,
|
|
251
|
-
max_frontier_entities: 50,
|
|
252
|
-
max_paths: args.top_k ?? 25,
|
|
253
|
-
});
|
|
254
221
|
case "transitions":
|
|
255
222
|
return target.transitions({
|
|
256
223
|
entity: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@littlebigbrain/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "MCP server for little big brain — graph and hybrid search tools for agents",
|
|
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.10.0",
|
|
56
56
|
"@modelcontextprotocol/sdk": "^1",
|
|
57
57
|
"zod": "^3"
|
|
58
58
|
},
|