MCPcopy Create free account
hub / github.com/MicrosoftDocs/mcp / createDefaultSdkClient

Method createDefaultSdkClient

cli/src/mcp/client.ts:273–302  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

271 }
272
273 private createDefaultSdkClient(): SdkClientLike {
274 return new Client(
275 {
276 name: this.options.clientName ?? DEFAULT_CLIENT_NAME,
277 version: this.options.clientVersion ?? '0.1.0',
278 },
279 {
280 capabilities: {},
281 listChanged: {
282 tools: {
283 onChanged: (error, tools) => {
284 if (error || !tools) {
285 this.cachedTools = undefined;
286 this.discoveredTools = undefined;
287 return;
288 }
289
290 try {
291 this.cachedTools = [...tools];
292 this.discoveredTools = discoverLearnTools(this.cachedTools);
293 } catch {
294 this.cachedTools = [...tools];
295 this.discoveredTools = undefined;
296 }
297 },
298 },
299 },
300 },
301 );
302 }
303
304 private createTransport(sessionId?: string): TransportLike {
305 if (this.options.createTransport) {

Callers 1

constructorMethod · 0.95

Calls 1

discoverLearnToolsFunction · 0.85

Tested by

no test coverage detected