Documentation
¶
Overview ¶
Copyright © 2025 Benny Powers <web@bennypowers.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2025 Benny Powers <web@bennypowers.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2025 Benny Powers <web@bennypowers.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2025 Benny Powers <web@bennypowers.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2025 Benny Powers <web@bennypowers.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Variables
- func BuildErrorResponse(message string) *mcp.CallToolResult
- func BuildSuccessResponse(content string) *mcp.CallToolResult
- func LookupElement(registry types.MCPContext, tagName string) (types.ElementInfo, *mcp.CallToolResult, error)
- func MakeGenerateConfigHandler(registry mcpTypes.MCPContext) mcp.ToolHandler
- func MakeGenerateHtmlHandler(registry types.MCPContext) mcp.ToolHandler
- func MakeValidateConfigHandler(registry mcpTypes.MCPContext) mcp.ToolHandler
- func MakeValidateHtmlHandler(registry types.MCPContext) mcp.ToolHandler
- func ParseToolArgs[T any](req *mcp.CallToolRequest) (T, error)
- func RenderTemplate(templateName string, data any) (string, error)
- func Tools(registry types.MCPContext) ([]types.ToolDefinition, error)
- type AttributeConflict
- type AttributeMap
- type AttributeWithValue
- type BaseTemplateData
- type ContentAttributeRedundancy
- type ElementUsage
- type ElementValidationResult
- type ElementWithCapabilities
- type ElementWithIssues
- type GenerateConfigArgs
- type GenerateHtmlArgs
- type HTMLGenerationTemplateData
- type HTMLValidationData
- type ResponseBuilder
- func (rb *ResponseBuilder) AddDescription(element types.ElementInfo) *ResponseBuilder
- func (rb *ResponseBuilder) AddHeader(level int, text string) *ResponseBuilder
- func (rb *ResponseBuilder) AddSection(content string) *ResponseBuilder
- func (rb *ResponseBuilder) AddTemplateSection(templateName string, data any) *ResponseBuilder
- func (rb *ResponseBuilder) Build() *mcp.CallToolResult
- func (rb *ResponseBuilder) String() string
- type SchemaDefinitionMap
- type SlotContentIssue
- type SlotWithContent
- type TemplateDataProvider
- type ValidateHtmlArgs
- type ValidationFeature
- type ValidationIssue
- type ValidationSuggestion
- type ValidationTemplateData
Constants ¶
This section is empty.
Variables ¶
var NewBaseTemplateData = types.NewBaseTemplateData
Use unified template data constructors from types package
var NewBaseTemplateDataWithSchema = types.NewBaseTemplateDataWithSchema
Functions ¶
func BuildErrorResponse ¶
func BuildErrorResponse(message string) *mcp.CallToolResult
BuildErrorResponse creates a standard error response for MCP tools
func BuildSuccessResponse ¶
func BuildSuccessResponse(content string) *mcp.CallToolResult
BuildSuccessResponse creates a standard success response for MCP tools
func LookupElement ¶
func LookupElement(registry types.MCPContext, tagName string) (types.ElementInfo, *mcp.CallToolResult, error)
LookupElement looks up an element in the registry and returns appropriate responses Returns: (element, errorResponse, error) - If element found: (element, nil, nil) - If element not found: (nil, errorResponse, nil) - If lookup failed: (nil, nil, error)
func MakeGenerateConfigHandler ¶ added in v0.11.0
func MakeGenerateConfigHandler(registry mcpTypes.MCPContext) mcp.ToolHandler
func MakeGenerateHtmlHandler ¶
func MakeGenerateHtmlHandler(registry types.MCPContext) mcp.ToolHandler
MakeGenerateHtmlHandler is the exported version for testing
func MakeValidateConfigHandler ¶ added in v0.11.0
func MakeValidateConfigHandler(registry mcpTypes.MCPContext) mcp.ToolHandler
func MakeValidateHtmlHandler ¶
func MakeValidateHtmlHandler(registry types.MCPContext) mcp.ToolHandler
MakeValidateHtmlHandler is the exported version for testing
func ParseToolArgs ¶
func ParseToolArgs[T any](req *mcp.CallToolRequest) (T, error)
ParseToolArgs parses JSON arguments from an MCP request into the specified type
func RenderTemplate ¶
RenderTemplate renders a template using the global thread-safe pool
func Tools ¶
func Tools(registry types.MCPContext) ([]types.ToolDefinition, error)
Tools returns all available tool definitions with their handlers
Types ¶
type AttributeConflict ¶
type AttributeConflict struct {
ElementTagName string
Attribute1 string
Value1 string
Attribute2 string
Value2 string
ConflictReason string
}
AttributeConflict represents conflicting attribute combinations
type AttributeMap ¶ added in v0.6.0
type AttributeWithValue ¶
AttributeWithValue pairs an attribute with its assigned value
type BaseTemplateData ¶
type BaseTemplateData = types.BaseTemplateData
type ContentAttributeRedundancy ¶
type ContentAttributeRedundancy struct {
ElementTagName string
AttributeName string
AttributeValue string
SlotName string
SlotContent string
}
ContentAttributeRedundancy represents cases where slot content overrides attributes
type ElementUsage ¶
ElementUsage represents a specific usage of an element in HTML
type ElementValidationResult ¶
type ElementValidationResult struct {
types.ElementInfo
TagName string
ElementFound bool
Usages []ElementUsage
}
ElementValidationResult represents specific element validation
type ElementWithCapabilities ¶
type ElementWithCapabilities struct {
types.ElementInfo
Capabilities []string
}
ElementWithCapabilities wraps an element with its capability strings
type ElementWithIssues ¶
type ElementWithIssues struct {
types.ElementInfo
UsageCount int
}
ElementWithIssues pairs an element with its validation results
type GenerateConfigArgs ¶ added in v0.11.0
type GenerateConfigArgs struct {
Focus string `json:"focus,omitempty"`
}
type GenerateHtmlArgs ¶
type GenerateHtmlArgs struct {
TagName string `json:"tagName"`
Context string `json:"context,omitempty"`
Options map[string]string `json:"options,omitempty"`
Content string `json:"content,omitempty"`
Attributes AttributeMap `json:"attributes,omitempty"`
}
GenerateHtmlArgs represents the arguments for the generate_html tool
type HTMLGenerationTemplateData ¶
type HTMLGenerationTemplateData struct {
BaseTemplateData
Content string
GeneratedHTML string
RequiredAttributes []AttributeWithValue
OptionalAttributes []AttributeWithValue
SortedAttributes []AttributeWithValue
Slots []SlotWithContent
}
HTMLGenerationTemplateData specific to HTML generation
func NewHTMLGenerationTemplateData ¶
func NewHTMLGenerationTemplateData(element types.ElementInfo, context string, options map[string]string) HTMLGenerationTemplateData
NewHTMLGenerationTemplateData creates HTML generation template data
func NewHTMLGenerationTemplateDataWithSchema ¶
func NewHTMLGenerationTemplateDataWithSchema(element types.ElementInfo, context string, options map[string]string, schemaDefinitions any) HTMLGenerationTemplateData
NewHTMLGenerationTemplateDataWithSchema creates HTML generation template data with schema context
type HTMLValidationData ¶
type HTMLValidationData struct {
Html string
Context string
FoundElements []ElementWithIssues
ManifestIssues []ValidationIssue
ManifestFeatures []ValidationFeature
SlotContentIssues []SlotContentIssue
AttributeConflicts []AttributeConflict
ContentAttributeRedundancies []ContentAttributeRedundancy
SpecificElement *ElementValidationResult
}
HTMLValidationData represents data for custom element validation templates
type ResponseBuilder ¶
type ResponseBuilder struct {
// contains filtered or unexported fields
}
ResponseBuilder provides a fluent interface for building tool responses
func NewResponseBuilder ¶
func NewResponseBuilder() *ResponseBuilder
NewResponseBuilder creates a new response builder
func (*ResponseBuilder) AddDescription ¶
func (rb *ResponseBuilder) AddDescription(element types.ElementInfo) *ResponseBuilder
AddDescription adds element description if available
func (*ResponseBuilder) AddHeader ¶
func (rb *ResponseBuilder) AddHeader(level int, text string) *ResponseBuilder
AddHeader adds a markdown header at the specified level
func (*ResponseBuilder) AddSection ¶
func (rb *ResponseBuilder) AddSection(content string) *ResponseBuilder
AddSection adds a section with content
func (*ResponseBuilder) AddTemplateSection ¶
func (rb *ResponseBuilder) AddTemplateSection(templateName string, data any) *ResponseBuilder
AddTemplateSection renders a template and adds it as a section
func (*ResponseBuilder) Build ¶
func (rb *ResponseBuilder) Build() *mcp.CallToolResult
Build creates the final MCP response
func (*ResponseBuilder) String ¶
func (rb *ResponseBuilder) String() string
String returns the current content as a string
type SchemaDefinitionMap ¶ added in v0.6.0
type SlotContentIssue ¶
type SlotContentIssue struct {
SlotName string
ElementTagName string
Guideline string
ViolationMessage string
}
SlotContentIssue represents content guideline violations in slots
type SlotWithContent ¶
SlotWithContent pairs a slot with example content
type TemplateDataProvider ¶
type TemplateDataProvider = types.TemplateDataProvider
Use unified template data types from types package
type ValidateHtmlArgs ¶
type ValidateHtmlArgs struct {
Html string `json:"html"`
Context string `json:"context,omitempty"`
TagName string `json:"tagName,omitempty"`
}
ValidateHtmlArgs represents the arguments for the validate_html tool
type ValidationFeature ¶
type ValidationFeature struct {
Type string // "slots", "guidelines", "css-apis"
Element string
Details string
}
ValidationFeature represents available manifest features
type ValidationIssue ¶
type ValidationIssue struct {
Type string // "missing-attribute", "invalid-value", "semantic-issue"
Element string
Attribute string
Expected string
Actual string
Message string
Priority string // "error", "warning", "info"
}
ValidationIssue represents a specific validation problem
type ValidationSuggestion ¶
type ValidationSuggestion struct {
Type string // "semantic-elements", "list-structure", "document-structure"
Priority string // "error", "warning", "suggestion"
Message string
}
ValidationSuggestion represents improvement suggestions
type ValidationTemplateData ¶
type ValidationTemplateData struct {
BaseTemplateData
Html string
FoundElements []ElementWithIssues
ManifestIssues []ValidationIssue
ManifestFeatures []ValidationFeature
SlotContentIssues []SlotContentIssue
AttributeConflicts []AttributeConflict
ContentAttributeRedundancies []ContentAttributeRedundancy
SpecificElement *ElementValidationResult
}
ValidationTemplateData specific to validation tools
func NewValidationTemplateData ¶
func NewValidationTemplateData(element mcpTypes.ElementInfo, context string, options map[string]string, html string) ValidationTemplateData
NewValidationTemplateData creates validation template data