mcptool

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mcptool holds what generated MCP tools call: their input, result and error.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(err error) error

Error is err as an MCP tool reports it. The assistant reads only the message, so the message of a *httpclient.APIError is followed by the response body, at most 4 KiB of it.

func Input

func Input(args json.RawMessage, in any) error

Input decodes the arguments of an MCP tool call into in again. The SDK reads them through float64, which rounds an integer above 2^53; an integer written as plain digits keeps all of them here. A key the call left out keeps what in holds, so the defaults the SDK filled in stay.

Types

type Result

type Result struct {
	Value any
}

Result is the structured content of an MCP tool. Clients before protocol 2026-07-28 take only a JSON object there, so Value is written as it is when it is one, else as {"result": Value}.

func (Result) MarshalJSON

func (r Result) MarshalJSON() ([]byte, error)

MarshalJSON writes Value as a JSON object.

Jump to

Keyboard shortcuts

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