mcpclient

package
v0.0.32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package mcpclient provides a lightweight MCP HTTP client for communicating with klaus agent instances. It wraps the mcp-go client library to handle session initialization, tool invocation, and per-instance session caching.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client manages MCP connections to klaus agent instances. It caches sessions per instance to avoid re-initializing on every call.

func New

func New(version string) *Client

New creates a new Client. The version string is sent during MCP session initialization so the remote agent knows which klausctl build is calling.

func (*Client) Close

func (c *Client) Close()

Close closes all cached sessions.

func (*Client) Prompt

func (c *Client) Prompt(ctx context.Context, instanceName, baseURL, message string) (*mcp.CallToolResult, error)

Prompt sends a prompt message to the agent instance.

func (*Client) Result

func (c *Client) Result(ctx context.Context, instanceName, baseURL string) (*mcp.CallToolResult, error)

Result retrieves the agent's last result.

func (*Client) SessionID

func (c *Client) SessionID(instanceName string) string

SessionID returns the MCP session ID for the given instance, if any.

func (*Client) Status

func (c *Client) Status(ctx context.Context, instanceName, baseURL string) (*mcp.CallToolResult, error)

Status queries the agent's current status.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL