Documentation
¶
Index ¶
- func GenerateToolName(path, method, operationID, xMCPName string) string
- func LoadSpec(ctx context.Context, source string) (*openapi3.T, error)
- func SanitizeToolName(s string) string
- func ServerURL(doc *openapi3.T, override string) (string, error)
- type GenerateOptions
- type GeneratedTool
- type MCPExtensions
- type ParamMeta
- type SchemaResult
- type TagFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateToolName ¶
GenerateToolName generates a tool name. Priority: x-mcp-tool-name > operationId > method_path.
func SanitizeToolName ¶
SanitizeToolName converts to valid MCP name: lowercase, alphanumeric, dots, underscores.
Types ¶
type GenerateOptions ¶
GenerateOptions configures tool generation.
type GeneratedTool ¶
type GeneratedTool struct {
Name string
Description string
InputSchema json.RawMessage
ParamMeta []ParamMeta
Path string
Method string
ServerURL string
}
GeneratedTool holds MCP tool definition and request metadata.
func Generate ¶
func Generate(ctx context.Context, opts GenerateOptions) ([]GeneratedTool, error)
Generate produces MCP tools from an OpenAPI spec.
type MCPExtensions ¶
MCPExtensions holds x-mcp-* extension fields.
func ExtractExtensions ¶
func ExtractExtensions(opExt, pathExt map[string]any) MCPExtensions
ExtractExtensions extracts x-mcp-* fields, preferring operation over path level.
type SchemaResult ¶
type SchemaResult struct {
InputSchema json.RawMessage
ParamMeta []ParamMeta
}
SchemaResult holds converted JSON Schema and parameter location metadata.
func ConvertSchema ¶
func ConvertSchema(params openapi3.Parameters, body *openapi3.RequestBodyRef) (*SchemaResult, error)
ConvertSchema merges parameters and body into flat JSON Schema, erroring on name collisions.
type TagFilter ¶
type TagFilter struct {
// contains filtered or unexported fields
}
TagFilter filters operations by tag, respecting x-mcp-hidden.
func NewTagFilter ¶
NewTagFilter returns a filter for the given tag.