mcp

package
v0.467.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleRegex = "[a-z][a-z0-9_]*"
	RefRegex    = "[a-z][a-z0-9_]*\\.[a-zA-Z_][a-zA-Z0-9_]*"
)

Variables

This section is empty.

Functions

func StatusTool

func StatusTool(ctx context.Context, buildEngineClient buildenginepbconnect.BuildEngineServiceClient,
	adminClient adminpbconnect.AdminServiceClient) (tool mcp.Tool, handler server.ToolHandlerFunc)

func TimelineTool

func TimelineTool(ctx context.Context, timelineClient timelinepbconnect.TimelineServiceClient) (tool mcp.Tool, handler server.ToolHandlerFunc)

func ToolFromCLI

func ToolFromCLI(ctx context.Context, k *kong.Kong, executor CLIExecutor, title string, cmdPath []string, toolOptions ...CLIToolOption) (mcp.Tool, server.ToolHandlerFunc)

Types

type CLIConfig

type CLIConfig struct {
	InputOptions map[string]*CLIOptionConfig
	ExtraHelp    []string
	ExtraArgs    []string
}

func (CLIConfig) Option

func (c CLIConfig) Option(name string) *CLIOptionConfig

type CLIExecutor

type CLIExecutor func(ctx context.Context, k *kong.Kong, args []string) error

type CLIOptionConfig

type CLIOptionConfig struct {
	IgnoreInModel   optional.Option[any]
	IncludeOptional bool
	Pattern         optional.Option[string]
}

type CLIToolOption

type CLIToolOption func(inputOptions *CLIConfig)

func AddHelp

func AddHelp(help string) CLIToolOption

func Args

func Args(args ...string) CLIToolOption

func Ignore

func Ignore(model any, name string) CLIToolOption

func IncludeOptional

func IncludeOptional(name string) CLIToolOption

func Pattern

func Pattern(name string, pattern optional.Option[string]) CLIToolOption

type CommandExecutor

type CommandExecutor func(ctx context.Context, k *kong.Kong, args []string, additionalExit func(int)) error

type Server

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

func New

func New() *Server

New creates a new mcp server with all the tools and resources

func (*Server) AddTool

func (s *Server) AddTool(tool mcp.Tool, handler server.ToolHandlerFunc)

AddTool adds a tool to the MCP server Panics if the tool is not able to marshal to json

func (*Server) Serve

func (s *Server) Serve() error

Serve starts the mcp server

Jump to

Keyboard shortcuts

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