Client
Note that the MCP.Client uses the Model Context Protocol Go SDK v1.5.0.
Constructors
Methods
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(parameters: Object
): void
Call a tool from the MCP server. https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk@v1.5.0/mcp#CallToolParams
Parameters
parameters:
Object
Request parameters
Returns
type:
void
close(): void
Closes the connection (over WebSocket) or connection attempt.
Returns
type:
void
id(): string
Returns the Client id.
Returns
type:
string
listTools(parameters: Object
): void
List the tools available from the MCP server. https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk@v1.5.0/mcp#ListToolsParams
Parameters
parameters:
Object
Request parameters
Returns
type:
void
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
OptionalOptional. Handler function. If not specified, all handler functions are removed
Returns
type:
void
webSocketId(): string
Returns the WebSocket id.
Returns
type:
string