mcp-use TypeScript API
    Preparing search index...

    Class NativeAdapter

    Converts MCP tools, resources, and prompts into provider-neutral tools.

    The adapter also creates a dispatcher that routes model tool calls back to the connector that supplied each tool.

    Hierarchy (View Summary)

    Index
    • Parameters

      • disallowedTools: string[] = []

        MCP tool names to omit during conversion.

      Returns NativeAdapter

    • Creates a dispatcher for the entries loaded by this adapter.

      Returns NativeCallToolFn

      A function that invokes tools, reads resources, or gets prompts.

      Error if the requested exposed tool name is unknown.

    • Removes internal dispatch metadata from native tool entries.

      Parameters

      Returns ProviderTool[]

      Provider-neutral definitions safe to send to an LLM provider.

    • Create tools from an MCPClient instance.

      This is the recommended way to create tools from an MCPClient, as it handles session creation and connector extraction automatically.

      Type Parameters

      Parameters

      • this: new (disallowedTools?: string[]) => TAdapter
      • client: MCPClient

        The MCPClient to extract tools from.

      • OptionaldisallowedTools: string[]

        Optional list of tool names to exclude.

      Returns Promise<TTool[]>

      A promise that resolves with a list of converted tools.