MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / withSessionView

Method withSessionView

src/mcp/tools.ts:2065–2079  ·  view source on GitHub ↗

* Attach the caller's session view to an explore call's args (CG-17), on a * COPY so the caller's object is never mutated. Nothing else sees it: a * non-explore tool, or a caller with no session state, gets the args * unchanged and pays nothing. * * A client that spells the internal k

(
    toolName: string,
    args: Record<string, unknown>,
    sessionState: ExploreSessionState | undefined,
  )

Source from the content-addressed store, hash-verified

2063 * to come from the server's own record, never from the wire.
2064 */
2065 private withSessionView(
2066 toolName: string,
2067 args: Record<string, unknown>,
2068 sessionState: ExploreSessionState | undefined,
2069 ): Record<string, unknown> {
2070 if (!(EXPLORE_SESSION_VIEW_ARG in args) && (!sessionState || toolName !== 'codegraph_explore')) {
2071 return args;
2072 }
2073 const copy = { ...args };
2074 delete copy[EXPLORE_SESSION_VIEW_ARG];
2075 if (sessionState && toolName === 'codegraph_explore') {
2076 copy[EXPLORE_SESSION_VIEW_ARG] = sessionState.view();
2077 }
2078 return copy;
2079 }
2080
2081 /**
2082 * Record an explore call's emission into the caller's session state and strip

Callers 1

executeMethod · 0.95

Calls 1

viewMethod · 0.80

Tested by

no test coverage detected