mcp

package
v0.474.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: Apache-2.0 Imports: 31 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 ReadTool added in v0.468.0

func ReadTool() (tool mcp.Tool, handler server.ToolHandlerFunc)

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(serverCtx context.Context, k *kong.Kong, projectConfig projectconfig.Config, buildEngineClient buildenginepbconnect.BuildEngineServiceClient, adminClient adminpbconnect.AdminServiceClient, executor CLIExecutor, title string, cmdPath []string, toolOptions ...CLIToolOption) (mcp.Tool, server.ToolHandlerFunc)

func WriteTool added in v0.468.0

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

Types

type CLIConfig

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

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 AutoReadFilePaths added in v0.468.0

func AutoReadFilePaths() CLIToolOption

AutoReadFilePaths enables filepath detection on the result of the CLI command. If a filepath within the project directory is detected, it will be read in and included in the result for the assistant. This speeds up the process of performing actions and then waiting for the assistant to read the file.

func Ignore

func Ignore(model any, name string) CLIToolOption

func IncludeOptional

func IncludeOptional(name string) CLIToolOption

func IncludeStatus added in v0.468.0

func IncludeStatus() 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

type StatusOutput added in v0.468.0

type StatusOutput struct {
	Modules []devstate.ModuleState
	Schema  string
}

func GetStatusOutput added in v0.468.0

func GetStatusOutput(ctx context.Context, buildEngineClient buildenginepbconnect.BuildEngineServiceClient, adminClient adminpbconnect.AdminServiceClient) (StatusOutput, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳