mcpserver

package
v0.16.86 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mcpserver is the JSON-RPC of the runtime's MCP server for agents: stateless Streamable HTTP, every POST carrying one message (or a batch) and getting its answer as plain JSON, nothing kept between calls. The tools come from toolsets (the preview's DevTools, the conversations an agent delegates), each answering for its own names.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseError

func ParseError() []byte

ParseError is the answer to a body that is not JSON.

func TextResult

func TextResult(text string, isError bool) *jsvalue.Object

TextResult is a tools/call result of one text.

Types

type Server

type Server struct {
	// Name is the name the server announces.
	Name string
	Sets []Toolset
}

Server answers the JSON-RPC messages of its toolsets, in their order.

func (*Server) Handle

func (s *Server) Handle(ctx context.Context, payload any) (int, []byte)

Handle answers a parsed POST body: 200 with a body, or 202 without one when there is nothing to answer.

type Toolset

type Toolset interface {
	// Instructions is what the server tells the agent of these tools at initialize.
	Instructions() string
	// Tools are the tools' definitions as tools/list gives them.
	Tools() []any
	Has(name string) bool
	// Call runs a tool the set has with its arguments (an object, empty when none were given): the tools/call result.
	Call(ctx context.Context, name string, args *jsvalue.Object) *jsvalue.Object
}

Toolset is a group of tools of the server.

Jump to

Keyboard shortcuts

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