@agorio/sdkDocs


Class: McpClient

Constructors

new McpClient()

new McpClient(options): McpClient

Parameters

options: McpClientOptions

Returns

McpClient

Defined in

src/client/mcp-client.ts:129

Methods

call()

call(method, params?): Promise<unknown>

Send a JSON-RPC 2.0 request and return the result.

Parameters

method: string

params?: Record<string, unknown>

Returns

Promise<unknown>

Defined in

src/client/mcp-client.ts:143


callTool()

callTool(name, args?): Promise<McpToolCallResult>

Invoke a tool by name with arbitrary JSON arguments.

Parameters

name: string

args?: Record<string, unknown>

Returns

Promise<McpToolCallResult>

Defined in

src/client/mcp-client.ts:226


getEndpoint()

getEndpoint(): string

Get the endpoint URL.

Returns

string

Defined in

src/client/mcp-client.ts:257


getPrompt()

getPrompt(name, args?): Promise<McpPromptGetResult>

Materialize a prompt with the given arguments.

Parameters

name: string

args?: Record<string, string>

Returns

Promise<McpPromptGetResult>

Defined in

src/client/mcp-client.ts:250


initialize()

initialize(opts?): Promise<McpInitializeResult>

Perform the MCP lifecycle handshake. Servers reply with their protocolVersion, serverInfo, and capabilities. Call once per session. Per spec, follow with notifyInitialized().

Parameters

opts?

opts.capabilities?: Record<string, unknown>

opts.clientInfo?: McpClientInfo

opts.protocolVersion?: string

Returns

Promise<McpInitializeResult>

Defined in

src/client/mcp-client.ts:200


listPrompts()

listPrompts(cursor?): Promise<McpPromptListResult>

List prompts the server exposes.

Parameters

cursor?: string

Returns

Promise<McpPromptListResult>

Defined in

src/client/mcp-client.ts:243


listResources()

listResources(cursor?): Promise<McpResourceListResult>

List resources the server exposes.

Parameters

cursor?: string

Returns

Promise<McpResourceListResult>

Defined in

src/client/mcp-client.ts:231


listTools()

listTools(cursor?): Promise<McpToolListResult>

List the tools the server exposes. Supports cursor pagination.

Parameters

cursor?: string

Returns

Promise<McpToolListResult>

Defined in

src/client/mcp-client.ts:219


notify()

notify(method, params?): Promise<void>

Send a JSON-RPC 2.0 notification (no response expected).

Parameters

method: string

params?: Record<string, unknown>

Returns

Promise<void>

Defined in

src/client/mcp-client.ts:179


notifyInitialized()

notifyInitialized(): Promise<void>

Notify the server that initialization is complete.

Returns

Promise<void>

Defined in

src/client/mcp-client.ts:214


readResource()

readResource(uri): Promise<McpResourceReadResult>

Read a resource by URI.

Parameters

uri: string

Returns

Promise<McpResourceReadResult>

Defined in

src/client/mcp-client.ts:238