mcputil

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer(name, version string) *server.MCPServer

NewServer creates a new MCP server with standard opsmate configuration.

func OptionalBool

func OptionalBool(req mcp.CallToolRequest, name string, defaultVal bool) bool

OptionalBool extracts an optional boolean parameter with a default.

func OptionalInt

func OptionalInt(req mcp.CallToolRequest, name string, defaultVal int) int

OptionalInt extracts an optional integer parameter with a default.

func OptionalString

func OptionalString(req mcp.CallToolRequest, name, defaultVal string) string

OptionalString extracts an optional string parameter with a default.

func RequireString

func RequireString(req mcp.CallToolRequest, name string) (string, error)

RequireString extracts a required string parameter from a tool request.

func SafeHandler

func SafeHandler(fn func(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)) func(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)

SafeHandler wraps a tool handler with panic recovery and context cancellation check.

func Serve

func Serve(s *server.MCPServer) error

Serve starts the MCP server on stdio transport.

func ToolError

func ToolError(format string, args ...any) (*mcp.CallToolResult, error)

ToolError returns a standardized tool error result.

func ToolText

func ToolText(format string, args ...any) (*mcp.CallToolResult, error)

ToolText returns a text tool result.

Types

This section is empty.

Jump to

Keyboard shortcuts

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