fix: add source titles to MCP graph facts - #383
Merged
Conversation
hurttlocker
approved these changes
Jul 11, 2026
hurttlocker
left a comment
Owner
There was a problem hiding this comment.
Verified locally: clean build, full internal/mcp suite green. Extending loadMemorySourcesForNodeViews to carry the section in the same batched IN-query was the right instinct — you closed #381 without inheriting the N+1 the CLI path has (#380 is still open if you want to bring the CLI side up to this standard). Same shared CitationTitleForResult path, regression mirrors the CLI test. Two-for-two today — merging.
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.
What
source_titleto MCPgraph_exploreandgraph_impactfact payloadssearch.CitationTitleForResulthelperWhy
MCP graph consumers currently receive only the raw
sourcepath, while CLI graph JSON exports also expose a human-readable source title. This brings the two graph surfaces into parity without duplicating citation-title logic.Fixes #381
How
The existing per-export memory lookup now selects both
source_fileandsource_sectioninto a map keyed by memory ID. Each graph fact uses those cached fields withCitationTitleForResult, preserving the existing source filter and avoiding per-fact database queries.Touched surfaces:
internal/mcp/graph_tools.gointernal/mcp/graph_tools_test.goProduct behavior changed: yes, additively; MCP graph fact JSON may now include
source_title.Benchmark/eval interpretation changed: no.
Testing
go test ./internal/mcp -run 'TestMCPGraphExplore(SourceTitleFallsBackToBaseFilename|BySubject|SourceFilter)' -count=1 -vgo test ./internal/mcp -count=1go test ./... -count=1go vet ./...go build ./cmd/cortex/python3 scripts/validate_visualizer_contract.pyscripts/connectivity_smoke.shgit diff --checkRisk
Low. The field is additive and omitted when no title can be derived. Existing source filtering and result ordering are unchanged.
AI-assisted contribution note
The implementation and test were AI-assisted. I reviewed the issue requirements, repository contribution rules, source-title helper reuse, query batching, generated diff, commit identity, and all test output listed above.
Checklist
gofmt,go vet)