mcp-use TypeScript API
    Preparing search index...

    Class LangChainAdapter

    Converts MCP tools, resources, and prompts into LangChain structured tools.

    Hierarchy (View Summary)

    Index
    • Create prompts from MCP prompts in all provided connectors.

      Parameters

      • connectors: BaseConnector[]

        List of MCP connectors to create prompts from.

      Returns Promise<StructuredToolInterface<ToolInputSchemaBase, any, any>[]>

      A promise that resolves with all converted prompts.

    • Create resources from MCP resources in all provided connectors.

      Parameters

      • connectors: BaseConnector[]

        List of MCP connectors to create resources from.

      Returns Promise<StructuredToolInterface<ToolInputSchemaBase, any, any>[]>

      A promise that resolves with all converted resources.

    • Converts MCP tools from all connectors and resets name deduplication.

      Parameters

      Returns Promise<StructuredToolInterface<ToolInputSchemaBase, any, any>[]>

      LangChain structured tools.

    • Dynamically load prompts for a specific connector.

      Parameters

      Returns Promise<StructuredToolInterface<ToolInputSchemaBase, any, any>[]>

      The list of prompts that were loaded in the target framework's format.

    • Dynamically load resources for a specific connector.

      Parameters

      Returns Promise<StructuredToolInterface<ToolInputSchemaBase, any, any>[]>

      The list of resources that were loaded in the target framework's format.

    • Dynamically load tools for a specific connector.

      Parameters

      Returns Promise<StructuredToolInterface<ToolInputSchemaBase, any, any>[]>

      The list of tools that were loaded in the target framework's format.

    • 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.