Rate this page:

Client

Note that the MCP.Client uses the Model Context Protocol Go SDK v1.5.0.

Constructors

constructor
Copy URL

Methods

addEventListener
Copy URL
addEventListener(event: 

any

,
callback:

Function

):

void

Adds a handler for the specified MCP.ServerEvents or [MCP.Events] event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.

Parameters

  • event:

    any

    Event class (i.e., MCP.ServerEvents.ToolsList)

  • callback:

    Function

    Handler function. A single parameter is passed - object with event information

Returns

  • type:

    void

callTool
Copy URL
callTool(parameters: 

Object

):

void

Parameters

  • parameters:

    Object

    Request parameters

Returns

  • type:

    void

close
Copy URL
close(): 

void

Closes the connection (over WebSocket) or connection attempt.

Returns

  • type:

    void

id
Copy URL
id(): 

string

Returns the Client id.

Returns

  • type:

    string

listTools
Copy URL
listTools(parameters: 

Object

):

void

Parameters

  • parameters:

    Object

    Request parameters

Returns

  • type:

    void

removeEventListener
Copy URL
removeEventListener(event: 

any

,
callback:

Function

):

void

Removes a handler for the specified MCP.ServerEvents or [MCP.Events] event.

Parameters

  • event:

    any

    Event class (i.e., MCP.ServerEvents.ToolsList)

  • callback:

    Function

    Optional

    Optional. Handler function. If not specified, all handler functions are removed

Returns

  • type:

    void

webSocketId
Copy URL
webSocketId(): 

string

Returns the WebSocket id.

Returns

  • type:

    string

Rate this page: