Documentation
¶
Overview ¶
Package codegen provides code generation for MCP tools. It generates TypeScript API files from MCP tool definitions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GeneratorStats ¶
GeneratorStats holds statistics about the code generation
type MCPCodeGenerator ¶
type MCPCodeGenerator struct {
// contains filtered or unexported fields
}
MCPCodeGenerator generates TypeScript code from MCP tool definitions
func NewMCPCodeGenerator ¶
func NewMCPCodeGenerator(manager *tools.MCPManager, outputDir string) *MCPCodeGenerator
NewMCPCodeGenerator creates a new code generator
func (*MCPCodeGenerator) Generate ¶
func (g *MCPCodeGenerator) Generate(ctx context.Context) error
Generate generates all TypeScript code for MCP tools
func (*MCPCodeGenerator) GetStats ¶
func (g *MCPCodeGenerator) GetStats() GeneratorStats
GetStats returns generation statistics
func (*MCPCodeGenerator) SetServerFilter ¶
func (g *MCPCodeGenerator) SetServerFilter(serverName string)
SetServerFilter sets a filter to only generate code for a specific server
type SchemaData ¶
type SchemaData struct {
Properties []SchemaProperty
}
SchemaData holds parsed schema information for templates
type SchemaProperty ¶
type SchemaProperty struct {
Name string
TypeScriptType string
Required bool
Description string
Default any
Enum []any
Minimum *float64
Maximum *float64
MinLength *int
MaxLength *int
Pattern string
Format string
// For arrays with object items
ArrayItemProperties []SchemaProperty
IsArrayOfObjects bool
}
SchemaProperty represents a property from a JSON schema with all metadata
type ToolData ¶
type ToolData struct {
ToolName string
MCPToolName string
ServerName string
Description string
InputSchema *SchemaData
HasOutputSchema bool
OutputSchema *SchemaData
}
ToolData holds template data for generating a tool file