hosttest

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 7 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 hosttest is an in-process host speaking the host protocol, for tests of mcp-sh itself and of host binaries' Go-side builtins. It is also the smallest complete reference for what a host must implement.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(req host.Request) host.InvokeResult

Handler answers one invoke.

type Host

type Host struct {
	Name     string
	Version  string
	Token    string // when set, requests must carry it
	Commands []host.CommandInfo
	Handlers map[string]Handler
	// HelpTexts answers the optional help method; nil means the host does not
	// implement it.
	HelpTexts map[string]string
	// GodotNumbers writes integers as floats ("exit_code":0.0), as Godot's JSON does.
	GodotNumbers bool
	// contains filtered or unexported fields
}

func (*Host) Calls

func (h *Host) Calls() []host.Request

Calls returns every request received so far.

func (*Host) Close

func (h *Host) Close()

func (*Host) Invokes

func (h *Host) Invokes() []host.Request

Invokes returns the received invoke requests.

func (*Host) Start

func (h *Host) Start() (addr string, err error)

Start listens on a free loopback port and serves until Close.

Jump to

Keyboard shortcuts

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