MCPcopy Index your code
hub / github.com/docsagent/docsagent / request

Method request

src/index.ts:174–193  ·  view source on GitHub ↗
(path: string, method: "GET" | "POST", body?: any)

Source from the content-addressed store, hash-verified

172 }
173
174 private async request(path: string, method: "GET" | "POST", body?: any): Promise<any> {
175 await this.readyPromise;
176
177 const url = `${this.baseUrl}${path}`;
178 try {
179 const response = await fetch(url, {
180 method,
181 headers: body ? { "Content-Type": "application/json" } : undefined,
182 body: body ? JSON.stringify(body) : undefined,
183 });
184
185 if (!response.ok) {
186 throw new Error(`HTTP error! status: ${response.status}`);
187 }
188
189 return await response.json();
190 } catch (error: any) {
191 throw new Error(`Failed to communicate with DocsAgent service: ${error.message}`);
192 }
193 }
194
195 /**
196 * Real-time document addition interface.

Callers 6

addMethod · 0.95
searchMethod · 0.95
statusMethod · 0.95
listMethod · 0.95
removeMethod · 0.95
closeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected