MCPcopy Index your code
hub / github.com/colbymchenry/codegraph / handleToolsList

Method handleToolsList

src/mcp/session.ts:221–237  ·  view source on GitHub ↗
(request: JsonRpcRequest)

Source from the content-addressed store, hash-verified

219 }
220
221 private async handleToolsList(request: JsonRpcRequest): Promise<void> {
222 await this.retryInitIfNeeded();
223 // Always expose the tools — even when the server root has no index. Gating
224 // availability on whether `./` is indexed (the old behavior) breaks the
225 // monorepo case where only sub-projects carry a `.codegraph/` (the agent
226 // saw zero tools and couldn't even reach an indexed sub-project by
227 // `projectPath`), and it hides the tools from a session that started before
228 // the user ran `codegraph init` (most hosts request the list once, so the
229 // freshly-built index never surfaces). #964. The not-indexed case is still
230 // safe: a call against an un-indexed path returns SUCCESS-shaped guidance
231 // ("pass projectPath / run codegraph init"), never `isError`, so it can't
232 // teach the agent to abandon codegraph. `getTools()` returns the default
233 // surface even before a project is open.
234 this.transport.sendResult(request.id, {
235 tools: this.engine.getToolHandler().getTools(),
236 });
237 }
238
239 private async handleToolsCall(request: JsonRpcRequest): Promise<void> {
240 const params = request.params as {

Callers 1

handleMessageMethod · 0.95

Calls 4

retryInitIfNeededMethod · 0.95
sendResultMethod · 0.80
getToolsMethod · 0.80
getToolHandlerMethod · 0.80

Tested by

no test coverage detected