MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / request

Method request

extensions/vscode/src/mcp/client.ts:151–173  ·  view source on GitHub ↗
(method: string, params: Record<string, unknown>)

Source from the content-addressed store, hash-verified

149 }
150
151 private async request(method: string, params: Record<string, unknown>): Promise<unknown> {
152 for (let attempt = 0; attempt < 2; attempt++) {
153 await this.ensureProcessReady();
154 if (!this.proc) throw new Error("Process missing");
155 try {
156 return await this.internalRequest(this.proc, method, params);
157 } catch (err) {
158 const msg = String(err);
159 const isChannelError = msg.includes("Channel has been closed") ||
160 msg.includes("stdin is not writable") ||
161 msg.includes("process exited");
162 if (isChannelError && attempt === 0) {
163 this.output.appendLine(`MCP channel error, restarting (${msg})`);
164 this.proc?.kill();
165 this.proc = undefined;
166 await this.ensureStarted();
167 continue;
168 }
169 throw err;
170 }
171 }
172 throw new Error("MCP request failed after retry");
173 }
174
175 private notify(method: string, params: Record<string, unknown>): void {
176 if (!this.proc) return;

Callers 3

listToolsMethod · 0.95
callToolMethod · 0.95
fetchGitlabArchiveFunction · 0.80

Calls 4

ensureProcessReadyMethod · 0.95
internalRequestMethod · 0.95
ensureStartedMethod · 0.95
StringClass · 0.50

Tested by

no test coverage detected