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

Method withSessionView

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

3422 * to come from the server's own record, never from the wire.
3423 */
3424 private withSessionView(
3425 toolName: string,
3426 args: Record<string, unknown>,
3427 sessionState: ExploreSessionState | undefined,
3428 ): Record<string, unknown> {
3429 if (!(EXPLORE_SESSION_VIEW_ARG in args) && (!sessionState || toolName !== 'codegraph_explore')) {
3430 return args;
3431 }
3432 const copy = { ...args };
3433 delete copy[EXPLORE_SESSION_VIEW_ARG];
3434 if (sessionState && toolName === 'codegraph_explore') {
3435 copy[EXPLORE_SESSION_VIEW_ARG] = sessionState.view();
3436 }
3437 return copy;
3438 }
3439
3440 /**
3441 * 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