toolhive

package
v0.0.0-...-4b5b113 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package toolhive provides utilities for interacting with ToolHive

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddWarningComment

func AddWarningComment(path, warning, detail string) error

AddWarningComment adds a warning comment to a spec file

func BuildRunCommand

func BuildRunCommand(spec *types.RegistryEntry, tempName, image string) []string

BuildRunCommand builds the thv run command arguments from a spec

func ParseToolsJSON

func ParseToolsJSON(output string) ([]string, error)

ParseToolsJSON parses JSON output from thv mcp list tools --format json

func ParseToolsText

func ParseToolsText(output string) ([]string, error)

ParseToolsText parses text output from thv mcp list (fallback parser)

func UpdateSpecTools

func UpdateSpecTools(path string, tools []string) error

UpdateSpecTools updates the tools field in a spec file

Types

type Client

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

Client represents a ToolHive client

func NewClient

func NewClient(thvPath string, verbose bool) (*Client, error)

NewClient creates a new ToolHive client

func (*Client) ListTools

func (c *Client) ListTools(serverName string) ([]string, error)

ListTools queries a running MCP server for its tools

func (*Client) Logs

func (c *Client) Logs(serverName string) (string, error)

Logs retrieves logs from a running MCP server

func (*Client) RemoveServer

func (c *Client) RemoveServer(serverName string) error

RemoveServer removes a stopped MCP server

func (*Client) RunServer

func (c *Client) RunServer(spec *types.RegistryEntry, serverName string) (string, error)

RunServer starts an MCP server from a spec

func (*Client) StopServer

func (c *Client) StopServer(serverName string) error

StopServer stops a running MCP server

type CommandBuilder

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

CommandBuilder helps build command line arguments for thv

func NewCommandBuilder

func NewCommandBuilder(command string) *CommandBuilder

NewCommandBuilder creates a new command builder

func (*CommandBuilder) AddBoolFlag

func (b *CommandBuilder) AddBoolFlag(flag string, value bool) *CommandBuilder

AddBoolFlag adds a boolean flag

func (*CommandBuilder) AddEnvVar

func (b *CommandBuilder) AddEnvVar(name, value string) *CommandBuilder

AddEnvVar adds an environment variable

func (*CommandBuilder) AddFlag

func (b *CommandBuilder) AddFlag(flag, value string) *CommandBuilder

AddFlag adds a flag with a value

func (*CommandBuilder) AddPositional

func (b *CommandBuilder) AddPositional(value string) *CommandBuilder

AddPositional adds a positional argument

func (*CommandBuilder) Build

func (b *CommandBuilder) Build() []string

Build returns the built command arguments

type MCPListOutput

type MCPListOutput struct {
	Tools []Tool `json:"tools"`
}

MCPListOutput represents the JSON output from thv mcp list

type Tool

type Tool struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	InputSchema map[string]interface{} `json:"inputSchema,omitempty"`
	Annotations map[string]interface{} `json:"annotations,omitempty"`
}

Tool represents an MCP tool

Jump to

Keyboard shortcuts

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