mcptest

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package mcptest provides helpers to drive a registered MCP server over the SDK's in-memory transport, for end-to-end tool tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSession

func NewSession(tb testing.TB, s *mcp.Server) *mcp.ClientSession

NewSession connects an in-memory client to s and returns the client session. The server connects on a background goroutine; the session is closed via tb.Cleanup. The client advertises no elicitation capability, so elicitation-gated write tools fail — use NewSessionWithElicitation for those.

func NewSessionWithElicitation

func NewSessionWithElicitation(
	tb testing.TB,
	s *mcp.Server,
	handler func(
		context.Context, *mcp.ElicitRequest,
	) (*mcp.ElicitResult, error),
) *mcp.ClientSession

NewSessionWithElicitation is like NewSession but wires handler as the client's elicitation handler, advertising the capability so write tools registered via toolkit.AddWrite can complete.

Types

This section is empty.

Jump to

Keyboard shortcuts

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