mcpclient

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMCPClientImplementation

func GetMCPClientImplementation() *mcp.Implementation

Types

type MATLABInfo

type MATLABInfo struct {
	Path    string `json:"matlab_root"`
	Version string `json:"version"`
}

MATLABInfo represents information about a MATLAB installation

type MCPClient

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

MCPClient wraps MCP session with helper methods Lifecycle: NewClient -> CreateSession -> [operations] -> Close

func NewClient

func NewClient(ctx context.Context, serverPath string, env []string, args ...string) *MCPClient

NewClient creates a new MCP client

func (*MCPClient) CreateSession

func (c *MCPClient) CreateSession(ctx context.Context) (*MCPClientSession, error)

type MCPClientSession

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

MCPClientSession represents an active MCP session

func (*MCPClientSession) CallTool

func (s *MCPClientSession) CallTool(ctx context.Context, name string, args map[string]any) (*mcp.CallToolResult, error)

CallTool calls an MCP tool and asserts it doesn't error

func (*MCPClientSession) CheckCode

func (s *MCPClientSession) CheckCode(ctx context.Context, scriptPath string) ([]string, error)

CheckCode checks MATLAB code

func (*MCPClientSession) Close

func (s *MCPClientSession) Close() error

func (*MCPClientSession) DetectToolboxes

func (s *MCPClientSession) DetectToolboxes(ctx context.Context) (string, error)

DetectToolboxes detects installed MATLAB toolboxes

func (*MCPClientSession) EvaluateCode

func (s *MCPClientSession) EvaluateCode(ctx context.Context, code string, projectPath ...string) (string, error)

EvaluateCode evaluates MATLAB code

func (*MCPClientSession) GetTextContent

func (*MCPClientSession) GetTextContent(result *mcp.CallToolResult) (string, error)

GetTextContent extracts text content from a tool result

func (*MCPClientSession) InitializeResult added in v0.5.0

func (s *MCPClientSession) InitializeResult() *mcp.InitializeResult

InitializeResult returns the result of the Initialize call.

func (*MCPClientSession) NewSessionManager

func (s *MCPClientSession) NewSessionManager() *SessionManager

NewSessionManager creates a new session manager for multi-session workflows

func (*MCPClientSession) ReadResource

func (s *MCPClientSession) ReadResource(ctx context.Context, uri string) (string, error)

ReadResource reads an MCP resource by URI and returns its text content

func (*MCPClientSession) RunFile

func (s *MCPClientSession) RunFile(ctx context.Context, scriptPath string) (string, error)

RunFile runs a MATLAB file

func (*MCPClientSession) RunTestFile

func (s *MCPClientSession) RunTestFile(ctx context.Context, scriptPath string) (string, error)

RunTestFile runs a MATLAB test file

func (*MCPClientSession) Stderr

func (s *MCPClientSession) Stderr() string

Stderr returns the captured stderr output from the MCP server process. This is useful for debugging test failures.

func (*MCPClientSession) UnmarshalStructuredContent

func (*MCPClientSession) UnmarshalStructuredContent(result *mcp.CallToolResult, target interface{}) error

UnmarshalStructuredContent unmarshals structured content into a target

type SessionManager

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

SessionManager helps manage MATLAB sessions

func (*SessionManager) CleanupSession

func (sm *SessionManager) CleanupSession(ctx context.Context, sessionID int)

CleanupSession stops a MATLAB session for cleanup, ignoring errors if the session is already gone

func (*SessionManager) EvaluateInSession

func (sm *SessionManager) EvaluateInSession(ctx context.Context, sessionID int, code string, projectPath ...string) (string, error)

EvaluateInSession evaluates code in a specific session

func (*SessionManager) ListAvailableMATLABs

func (sm *SessionManager) ListAvailableMATLABs(ctx context.Context) ([]MATLABInfo, error)

ListAvailableMATLABs lists available MATLAB installations

func (*SessionManager) StartSession

func (sm *SessionManager) StartSession(ctx context.Context, matlabRoot ...string) (int, error)

StartSession starts a new MATLAB session

func (*SessionManager) StopSession

func (sm *SessionManager) StopSession(ctx context.Context, sessionID int) error

StopSession stops a MATLAB session

Jump to

Keyboard shortcuts

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