Strands Agents Typescript SDK
    Preparing search index...

    Class McpClient

    MCP Client for interacting with Model Context Protocol servers.

    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    Methods

    • Connects the MCP client to the server.

      This function is exposed to allow consumers to connect manually, but will be called lazily before any operations that require a connection.

      Parameters

      • reconnect: boolean = false

      Returns Promise<void>

      A promise that resolves when the connection is established.

    • Disconnects the MCP client from the server and cleans up resources.

      Returns Promise<void>

      A promise that resolves when the disconnection is complete.

    • Lists the tools available on the server and returns them as executable McpTool instances.

      Returns Promise<McpTool[]>

      A promise that resolves with an array of McpTool instances.

    • Invoke a tool on the connected MCP server using an McpTool instance.

      Parameters

      • tool: McpTool

        The McpTool instance to invoke.

      • args: JSONValue

        The arguments to pass to the tool.

      Returns Promise<JSONValue>

      A promise that resolves with the result of the tool invocation.