mcpruntime

package
v0.260414.2000 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureBuiltinScripts

func EnsureBuiltinScripts(configDir string) error

EnsureBuiltinScripts copies bundled MCP scripts to <configDir>/mcp. This guarantees stdio MCP scripts are available at a stable path for runtime config.

func IsMCPToolName

func IsMCPToolName(name string) bool

IsMCPToolName checks whether a tool name is a normalized MCP tool.

func NormalizeToolName

func NormalizeToolName(sourceID, toolName string) string

NormalizeToolName converts source/tool pair to normalized tool name.

func ParseNormalizedToolName

func ParseNormalizedToolName(name string) (string, string, bool)

ParseNormalizedToolName parses normalized name and returns sourceID/toolName.

Types

type Runtime

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

Runtime handles MCP tool source discovery and tool execution.

func NewRuntime

func NewRuntime(getConfig configProvider) *Runtime

NewRuntime creates a new MCP runtime.

func (*Runtime) CallTool

func (r *Runtime) CallTool(ctx context.Context, normalizedName string, arguments string) (string, error)

CallTool executes a normalized MCP tool call and returns serialized result.

func (*Runtime) Close

func (r *Runtime) Close()

Close releases all MCP sessions.

func (*Runtime) GetConfig added in v0.260414.2000

func (r *Runtime) GetConfig() *typ.MCPRuntimeConfig

GetConfig returns the current MCP runtime configuration.

func (*Runtime) ListOpenAITools

func (r *Runtime) ListOpenAITools(ctx context.Context) []openai.ChatCompletionToolUnionParam

ListOpenAITools returns all MCP tools in normalized OpenAI function-tool format.

func (*Runtime) ListSourceTools added in v0.260414.2000

func (r *Runtime) ListSourceTools(ctx context.Context) (map[string][]SourceTool, error)

ListSourceTools returns all MCP tools grouped by source with their original names. This is used by local mode to expose tools to external MCP clients.

type SourceTool added in v0.260414.2000

type SourceTool struct {
	SourceID    string
	SourceName  string
	Name        string
	Description string
	InputSchema json.RawMessage
}

SourceTool represents a tool from a specific MCP source with its original name.

Jump to

Keyboard shortcuts

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