fix(server): thread graph_rel_types through the mcp kb_context tool - #722
Merged
plind-junior merged 2 commits intoJul 31, 2026
Merged
Conversation
the mcp kb_context tool exposes expand_graph/graph_depth/graph_limit but drops graph_rel_types, which the jsonl _h_context handler threads and build_context_pack supports. so an mcp agent — the primary vouch client — can graph-expand a context pack but cannot scope the walk to specific relation types, unlike a jsonl/http client (and unlike the kb_neighbors tool, which does expose rel_types on mcp). thread it, mirroring _h_context.
Contributor
|
diff coverage: n/a — this PR changes no python under |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
the mcp
kb_contexttool exposes the graph-expansion knobsexpand_graph/graph_depth/graph_limitbut dropsgraph_rel_types, which the jsonl_h_contexthandler threads andbuild_context_packfully supports (context.py→graph.graph_neighbors_for_seeds(..., rel_types=...)).so an mcp agent — claude code / cursor / codex, the primary way vouch is consumed — can graph-expand a context pack and tune its depth/breadth, but cannot restrict which relation types the walk follows.
expand_graph=truepulls neighbors across every relation type (contradicts, supersedes, references, …) with no way to scope to, e.g., onlyreferences. a jsonl/http/rpcclient can. the siblingkb_neighborstool already exposesrel_typeson mcp, so relation-type filtering is a first-class mcp capability everywhere except context-pack graph expansion.this is the same surface-drift class as the
kb_exportexcludefix: pr #185 addedgraph_rel_typestobuild_context_packand the jsonl handler but its mcp-tool hunk never threaded it.fix
add the optional
graph_rel_types: list[str] | Noneparam tokb_contextand thread it intobuild_context_pack, mirroring_h_context.test
test_kb_context_mcp_honors_graph_rel_types(intests/test_graph.py) builds a claim with areferencesedge toauthand ablocksedge torisk, then calls the mcp tool withgraph_rel_types=["references"]and assertsauthis included andriskis filtered out. it fails on the current code (TypeError: unexpected keyword argument 'graph_rel_types') and passes with the fix.validation
mypy src(117 files, no issues),ruff checkon the touched files, and the graph / context / capabilities / server-tool-surface / jsonl-server-surface suites all pass locally.