@mcp-z/server
    Preparing search index...

    Interface ToolModule<TConfig, THandler>

    Tool module interface with bounded generics.

    interface ToolModule<TConfig = ToolConfig, THandler = unknown> {
        config: TConfig;
        handler: THandler;
        name: string;
    }

    Type Parameters

    • TConfig = ToolConfig

      Tool config type (default: SDK ToolConfig)

    • THandler = unknown

      Handler function type (default: ToolHandler)

      Use without generics for SDK-typed tools:

      • Business tool factories: ToolModule
      • Tool registration: ToolModule[]

      Use with generics for middleware transformation:

      • Auth middleware: ToolModule<ToolConfig, ToolHandler<TArgs, EnrichedExtra>>

      The bounds ensure compatibility with SDK registration. Tools are created via factory functions that inject dependencies via closure.

      Note: Handler uses unknown by default to avoid contravariance issues when specific handler types are inferred via satisfies pattern. The SDK validates handlers at runtime.

    Index

    Properties

    Properties

    config: TConfig
    handler: THandler
    name: string