Documentation
¶
Overview ¶
Package api implements the MCP (Model Context Protocol) server functionality.
It provides a Service that registers and handles MCP tools for code generation rule management. The package uses stdio transport for MCP communication and supports concurrent operations through error groups. Each tool is registered with debug logging for request tracking.
Index ¶
- type CodeStyleArgs
- type Config
- type MockToolHandler
- type MockToolHandler_Expecter
- type MockToolHandler_GetCodeStyle_Call
- func (_c *MockToolHandler_GetCodeStyle_Call) Return(_a0 []core.Rule, _a1 error) *MockToolHandler_GetCodeStyle_Call
- func (_c *MockToolHandler_GetCodeStyle_Call) Run(run func(ctx context.Context, categories []string)) *MockToolHandler_GetCodeStyle_Call
- func (_c *MockToolHandler_GetCodeStyle_Call) RunAndReturn(run func(context.Context, []string) ([]core.Rule, error)) *MockToolHandler_GetCodeStyle_Call
- type Service
- type ToolHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeStyleArgs ¶
type CodeStyleArgs struct { // Categories for filtering rules Categories string `` /* 163-byte string literal not displayed */ }
CategoryArgs holds the category parameter for rule filtering. Used to specify the category of code generation rules to retrieve.
type Config ¶
type Config struct { }
Config holds the service configuration parameters. Currently empty but maintained for future configuration options.
type MockToolHandler ¶
MockToolHandler is an autogenerated mock type for the ToolHandler type
func NewMockToolHandler ¶
func NewMockToolHandler(t interface { mock.TestingT Cleanup(func()) }) *MockToolHandler
NewMockToolHandler creates a new instance of MockToolHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockToolHandler) EXPECT ¶
func (_m *MockToolHandler) EXPECT() *MockToolHandler_Expecter
func (*MockToolHandler) GetCodeStyle ¶
func (_m *MockToolHandler) GetCodeStyle(ctx context.Context, categories []string) ([]core.Rule, error)
GetCodeStyle provides a mock function with given fields: ctx, categories
type MockToolHandler_Expecter ¶
type MockToolHandler_Expecter struct {
// contains filtered or unexported fields
}
func (*MockToolHandler_Expecter) GetCodeStyle ¶
func (_e *MockToolHandler_Expecter) GetCodeStyle(ctx interface{}, categories interface{}) *MockToolHandler_GetCodeStyle_Call
GetCodeStyle is a helper method to define mock.On call
- ctx context.Context
- categories []string
type MockToolHandler_GetCodeStyle_Call ¶
MockToolHandler_GetCodeStyle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCodeStyle'
func (*MockToolHandler_GetCodeStyle_Call) Return ¶
func (_c *MockToolHandler_GetCodeStyle_Call) Return(_a0 []core.Rule, _a1 error) *MockToolHandler_GetCodeStyle_Call
func (*MockToolHandler_GetCodeStyle_Call) Run ¶
func (_c *MockToolHandler_GetCodeStyle_Call) Run(run func(ctx context.Context, categories []string)) *MockToolHandler_GetCodeStyle_Call
func (*MockToolHandler_GetCodeStyle_Call) RunAndReturn ¶
func (_c *MockToolHandler_GetCodeStyle_Call) RunAndReturn(run func(context.Context, []string) ([]core.Rule, error)) *MockToolHandler_GetCodeStyle_Call
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements the MCP server functionality for code generation rules. It registers tools for rule management and handles their execution through the provided ToolHandler. The service is safe for concurrent use.
func New ¶
func New(cfg *Config, handler ToolHandler) *Service
New creates a new Service instance with the provided configuration and handler. The handler must be properly initialized and safe for concurrent use.
type ToolHandler ¶
type ToolHandler interface {
GetCodeStyle(ctx context.Context, categories []string) ([]core.Rule, error)
}
ToolHandler defines the interface for handling code generation rule operations. Implementations must be safe for concurrent use as methods may be called simultaneously by different MCP tool handlers.