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

Method withSessionView

src/mcp/tools.ts:3265–3279  ·  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

3263 * to come from the server's own record, never from the wire.
3264 */
3265 private withSessionView(
3266 toolName: string,
3267 args: Record<string, unknown>,
3268 sessionState: ExploreSessionState | undefined,
3269 ): Record<string, unknown> {
3270 if (!(EXPLORE_SESSION_VIEW_ARG in args) && (!sessionState || toolName !== 'codegraph_explore')) {
3271 return args;
3272 }
3273 const copy = { ...args };
3274 delete copy[EXPLORE_SESSION_VIEW_ARG];
3275 if (sessionState && toolName === 'codegraph_explore') {
3276 copy[EXPLORE_SESSION_VIEW_ARG] = sessionState.view();
3277 }
3278 return copy;
3279 }
3280
3281 /**
3282 * 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