MCP TypeScript SDK (V2)
    Preparing search index...
    ClientOptions: ProtocolOptions & {
        capabilities?: Omit<ClientCapabilities, "tasks"> & {
            tasks?: ClientTasksCapabilityWithRuntime;
        };
        jsonSchemaValidator?: jsonSchemaValidator;
        listChanged?: ListChangedHandlers;
    }

    Type Declaration

    • Optionalcapabilities?: Omit<ClientCapabilities, "tasks"> & { tasks?: ClientTasksCapabilityWithRuntime }

      Capabilities to advertise as being supported by this client.

    • OptionaljsonSchemaValidator?: jsonSchemaValidator

      JSON Schema validator for tool output validation.

      The validator is used to validate structured content returned by tools against their declared output schemas.

      DefaultJsonSchemaValidator (AjvJsonSchemaValidator on Node.js, CfWorkerJsonSchemaValidator on Cloudflare Workers)

    • OptionallistChanged?: ListChangedHandlers

      Configure handlers for list changed notifications (tools, prompts, resources).

      const client = new Client(
      { name: 'my-client', version: '1.0.0' },
      {
      listChanged: {
      tools: {
      onChanged: (error, tools) => {
      if (error) {
      console.error('Failed to refresh tools:', error);
      return;
      }
      console.log('Tools updated:', tools);
      }
      },
      prompts: {
      onChanged: (error, prompts) => console.log('Prompts updated:', prompts)
      }
      }
      }
      );