Help us shape the future of Go! Take the 2026 Go Developer Survey

mcptest

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package mcptest drives a server over the SDK's in-memory transport for tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListResourceTemplateURIs added in v0.4.0

func ListResourceTemplateURIs(tb testing.TB, cs *mcp.ClientSession) []string

ListResourceTemplateURIs returns all advertised URI templates, paginated.

func ListResourceURIs added in v0.4.0

func ListResourceURIs(tb testing.TB, cs *mcp.ClientSession) []string

ListResourceURIs returns all advertised static-resource URIs, paginated.

func NewSession

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

NewSession connects an in-memory client to s, advertising no elicitation.

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 an elicit handler.

func ReadResourceBlob added in v0.4.0

func ReadResourceBlob(
	tb testing.TB,
	cs *mcp.ClientSession,
	uri string,
) []byte

ReadResourceBlob reads uri and returns the first content's Blob bytes.

func ReadResourceJSON added in v0.4.0

func ReadResourceJSON[T any](
	tb testing.TB,
	cs *mcp.ClientSession,
	uri string,
) T

ReadResourceJSON reads uri and unmarshals the first content's Text into T.

func ReadResourceText added in v0.4.0

func ReadResourceText(
	tb testing.TB,
	cs *mcp.ClientSession,
	uri string,
) string

ReadResourceText reads uri and returns the first content's Text.

Types

This section is empty.

Jump to

Keyboard shortcuts

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