Documentation
¶
Overview ¶
internal/openapi/schema.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Components ¶
type Components struct {
Schemas map[string]Schema `json:"schemas,omitempty"`
SecuritySchemes map[string]SecurityScheme `json:"securitySchemes,omitempty"`
}
type OpenAPISchema ¶
type OpenAPISchema struct {
OpenAPI string `json:"openapi"`
Info Info `json:"info"`
Servers []Server `json:"servers"`
Paths map[string]PathItem `json:"paths"`
Specs []ToolSpec `json:"specs,omitempty"` // Added specs field for OpenWebUI
Components Components `json:"components"`
Security []map[string][]string `json:"security,omitempty"`
}
OpenAPISchema represents an OpenAPI 3.0 schema.
func GenerateOpenAPISchema ¶
func GenerateOpenAPISchema(serverName string, tools []Tool) (*OpenAPISchema, error)
GenerateOpenAPISchema generates an OpenAPI schema for MCP tools with full annotations.
type Operation ¶
type Operation struct {
Summary string `json:"summary"`
Description string `json:"description,omitempty"`
OperationID string `json:"operationId"`
RequestBody RequestBody `json:"requestBody,omitempty"`
Responses map[string]Response `json:"responses"`
Security []map[string][]string `json:"security,omitempty"`
Tags []string `json:"tags,omitempty"`
// MCP Operation Extensions
MCPMethod string `json:"x-mcp-method,omitempty"`
MCPHints *ToolAnnotations `json:"x-mcp-hints,omitempty"`
}
type RequestBody ¶
type Schema ¶
type Schema struct {
Type string `json:"type,omitempty"`
Properties map[string]Schema `json:"properties,omitempty"`
Required []string `json:"required,omitempty"`
Items *Schema `json:"items,omitempty"`
Description string `json:"description,omitempty"`
Ref string `json:"$ref,omitempty"`
AdditionalProperties *Schema `json:"additionalProperties,omitempty"`
}
type SecurityScheme ¶
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema map[string]interface{} `json:"inputSchema"`
// MCP Tool Annotations
Annotations *ToolAnnotations `json:"annotations,omitempty"`
}
Enhanced Tool with MCP annotations.
type ToolAnnotations ¶
type ToolAnnotations struct {
ReadOnlyHint bool `json:"readOnlyHint,omitempty"` // Tool is read-only
DestructiveHint bool `json:"destructiveHint,omitempty"` // Tool may be destructive
IdempotentHint bool `json:"idempotentHint,omitempty"` // Tool is idempotent
OpenWorldHint bool `json:"openWorldHint,omitempty"` // Tool accepts arbitrary parameters
}
ToolAnnotations represents MCP tool annotations.
type ToolSpec ¶
type ToolSpec struct {
Type string `json:"type"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Parameters map[string]interface{} `json:"parameters,omitempty"`
// MCP Tool Annotations
Annotations *ToolAnnotations `json:"annotations,omitempty"`
}
Enhanced ToolSpec with full MCP annotations.
Click to show internal directories.
Click to hide internal directories.