toolschema

package
v1.169.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 8 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 toolschema answers what a registered tool's advertised input schema is, read from the MCP server's own tools/list.

The error contract asks it when a call is refused because its arguments do not match the tool's schema (#2811): the refusal lists the parameters the tool accepts, and only the server knows them for every tool. mcp-trino registers its tools upstream, and a gateway connection's tools come from another server, so no registration helper the platform owns sees them all. The schema read is the one a client is shown, list decorators included, so a parameter the platform injects (session_id, purpose) is listed as accepted, which it is.

The listing is taken on demand over an in-memory session and cached, so a refusal costs one listing at most once per TTL, and a tool added after the last listing (a gateway connection) is found by listing again on a miss.

Index

Constants

View Source
const DefaultTTL = time.Minute

DefaultTTL is how long a listing answers before the next lookup lists again.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lookup

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

Lookup reads input schemas from one server's tools/list.

func New

func New(server *mcp.Server, ttl time.Duration) *Lookup

New returns a lookup over server's listing, cached for ttl (DefaultTTL when zero or negative).

func (*Lookup) InputSchema

func (l *Lookup) InputSchema(ctx context.Context, name string) map[string]any

InputSchema returns the named tool's advertised input schema as decoded JSON, or nil when the server holds no such tool or cannot be listed. A miss in a fresh listing lists again once, so a tool registered since is found.

Jump to

Keyboard shortcuts

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