MCP TypeScript SDK
    Preparing search index...

    Type Alias ClientOptions

    ClientOptions: ProtocolOptions & {
        capabilities?: ClientCapabilities;
        jsonSchemaValidator?: jsonSchemaValidator;
        listChanged?: ListChangedHandlers;
    }

    Type Declaration

    • Optionalcapabilities?: ClientCapabilities

      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.

      AjvJsonSchemaValidator
      
      // ajv
      const client = new Client(
      { name: 'my-client', version: '1.0.0' },
      {
      capabilities: {},
      jsonSchemaValidator: new AjvJsonSchemaValidator()
      }
      );

      // @cfworker/json-schema
      const client = new Client(
      { name: 'my-client', version: '1.0.0' },
      {
      capabilities: {},
      jsonSchemaValidator: new CfWorkerJsonSchemaValidator()
      }
      );
    • 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)
      }
      }
      }
      );