mcp

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package mcp is Datly's default implementation of the public outbound MCP client contract (github.com/viant/xdatly/client/mcp) built on github.com/viant/mcp. Sessions are scoped by the exact header set they were initialized with, so principals never share a session and every HTTP stage of a session carries the same explicit headers.

Index

Constants

View Source
const (
	// TransportStreamable is the supported viant/mcp HTTP transport.
	TransportStreamable = "streamable"
)

Variables

This section is empty.

Functions

func SessionKey

func SessionKey(header http.Header) string

SessionKey identifies a session by its complete header set. JSON orders map keys deterministically while preserving value order and boundaries, so reordered or merged repeated headers never reuse another session.

func Validate

func Validate(options xmcp.Options) error

Validate checks the complete declaration without opening any connection.

Types

type Client

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

Client implements xmcp.Client for one configured endpoint and tool.

func New

func New(options xmcp.Options) (*Client, error)

New validates options and builds the client. No connection is opened until the first call.

func (*Client) CallTool

func (c *Client) CallTool(ctx context.Context, request *schema.CallToolRequest, options xmcp.CallOptions) (*schema.CallToolResult, error)

CallTool invokes the configured tool. The request's tool name must match the configuration; the native result, including isError, is returned unchanged and protocol errors are returned as errors.

func (*Client) Close

func (c *Client) Close() error

Close releases every session. Only the provider owner calls it.

func (*Client) Identity

func (c *Client) Identity() string

Identity is the digest of the options the client was built from.

func (*Client) Sessions

func (c *Client) Sessions() int

Sessions reports the number of live header-scoped sessions.

Jump to

Keyboard shortcuts

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