MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / context

Function context

graph-ui/src/browser-ai/graph-context.ts:19–37  ·  view source on GitHub ↗
(relation: 'calls' | 'calledBy', fact: Fact<CallSite[]> | Fact<CallerRef[]> | undefined)

Source from the content-addressed store, hash-verified

17export function browserGraphContext(ir: SemanticIR | undefined, project: string, activePath: string, twinPath: string): BrowserChatContext[] {
18 if (!ir || !activePath || activePath !== twinPath || (ir.symbol.projectName && ir.symbol.projectName !== project)) return [];
19 const context = (relation: 'calls' | 'calledBy', fact: Fact<CallSite[]> | Fact<CallerRef[]> | undefined): BrowserChatContext => {
20 const value = relation === 'calls' ? (fact?.value as CallSite[] | undefined)?.map(callWithoutArguments) : fact?.value;
21 return {
22 id: `graph:${JSON.stringify([project, activePath, ir.symbol.uri, ir.symbol.nodeId ?? ir.symbol.qualifiedName ?? ir.symbol.name, ir.generation, relation])}`,
23 label: `${relation === 'calls' ? 'Calls' : 'Called by'} · ${ir.symbol.name} · ${fact?.state ?? 'unavailable'}`,
24 text: JSON.stringify({
25 kind: 'graph-context-snapshot',
26 project,
27 path: activePath,
28 twinPath,
29 generation: ir.generation,
30 symbol: ir.symbol,
31 coordinates: { symbolRanges: 'zero-based', callLines: 'one-based', evidenceRanges: 'one-based inclusive' },
32 relation,
33 fact: fact ? { present: true, state: fact.state, value, evidence: fact.evidence } : { present: false },
34 limitations: 'Provider results are best-effort, not an exhaustive call graph. An absent or unknown fact does not mean there are no relationships. Call argument excerpts are omitted because the provider may truncate them.',
35 }, null, 2),
36 };
37 };
38 return [context('calls', ir.calls), context('calledBy', ir.calledBy)];
39}

Callers 1

browserGraphContextFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected