remove sensory tools
This commit is contained in:
116
mcp/main.go
116
mcp/main.go
@@ -4331,122 +4331,6 @@ func main() {
|
||||
}, nil
|
||||
})
|
||||
|
||||
// Register web_sensory_characteristics tool
|
||||
mcpServer.AddTool(mcp.Tool{
|
||||
Name: "web_sensory_characteristics_cremotemcp",
|
||||
Description: "Detect instructions that rely only on sensory characteristics like color, shape, size, visual location, or sound (WCAG 1.3.3)",
|
||||
InputSchema: mcp.ToolInputSchema{
|
||||
Type: "object",
|
||||
Properties: map[string]any{
|
||||
"tab": map[string]any{
|
||||
"type": "string",
|
||||
"description": "Tab ID (optional, uses current tab)",
|
||||
},
|
||||
"timeout": map[string]any{
|
||||
"type": "integer",
|
||||
"description": "Timeout in seconds (default: 10)",
|
||||
"default": 10,
|
||||
},
|
||||
},
|
||||
Required: []string{},
|
||||
},
|
||||
}, func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
||||
params, ok := request.Params.Arguments.(map[string]any)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("invalid arguments format")
|
||||
}
|
||||
|
||||
tab := getStringParam(params, "tab", cremoteServer.currentTab)
|
||||
timeout := getIntParam(params, "timeout", 10)
|
||||
|
||||
result, err := cremoteServer.client.DetectSensoryCharacteristics(tab, timeout)
|
||||
if err != nil {
|
||||
return &mcp.CallToolResult{
|
||||
Content: []mcp.Content{
|
||||
mcp.NewTextContent(fmt.Sprintf("Failed to detect sensory characteristics: %v", err)),
|
||||
},
|
||||
IsError: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Format results as JSON
|
||||
resultJSON, err := json.MarshalIndent(result, "", " ")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to marshal results: %w", err)
|
||||
}
|
||||
|
||||
// Create summary
|
||||
complianceStatus := "✅ PASS"
|
||||
if result.Violations > 0 {
|
||||
complianceStatus = "❌ VIOLATIONS FOUND"
|
||||
} else if result.Warnings > 0 {
|
||||
complianceStatus = "⚠️ WARNINGS"
|
||||
}
|
||||
|
||||
summary := fmt.Sprintf("Sensory Characteristics Detection Results:\n\n"+
|
||||
"Summary:\n"+
|
||||
" Total Elements Analyzed: %d\n"+
|
||||
" Elements with Issues: %d\n"+
|
||||
" Compliance Status: %s\n"+
|
||||
" Violations: %d\n"+
|
||||
" Warnings: %d\n\n",
|
||||
result.TotalElements,
|
||||
result.ElementsWithIssues,
|
||||
complianceStatus,
|
||||
result.Violations,
|
||||
result.Warnings)
|
||||
|
||||
// Add pattern matches
|
||||
if len(result.PatternMatches) > 0 {
|
||||
summary += "Pattern Matches:\n"
|
||||
for pattern, count := range result.PatternMatches {
|
||||
summary += fmt.Sprintf(" - %s: %d occurrences\n", pattern, count)
|
||||
}
|
||||
summary += "\n"
|
||||
}
|
||||
|
||||
// Add violations/warnings
|
||||
if result.ElementsWithIssues > 0 {
|
||||
summary += "Elements with Issues:\n"
|
||||
for i, elem := range result.Elements {
|
||||
if i >= 10 { // Limit to first 10 for readability
|
||||
summary += fmt.Sprintf("\n ... and %d more elements\n", len(result.Elements)-10)
|
||||
break
|
||||
}
|
||||
summary += fmt.Sprintf("\n %d. <%s>\n", i+1, elem.TagName)
|
||||
summary += fmt.Sprintf(" Text: \"%s\"\n", elem.Text)
|
||||
summary += fmt.Sprintf(" Matched Patterns: %v\n", elem.MatchedPatterns)
|
||||
summary += fmt.Sprintf(" Severity: %s\n", elem.Severity)
|
||||
summary += fmt.Sprintf(" Recommendation: %s\n", elem.Recommendation)
|
||||
}
|
||||
summary += "\n"
|
||||
}
|
||||
|
||||
// Add recommendations
|
||||
if result.Violations > 0 {
|
||||
summary += "⚠️ CRITICAL RECOMMENDATIONS:\n"
|
||||
summary += " 1. Provide additional non-sensory cues for all instructions\n"
|
||||
summary += " 2. Use text labels, ARIA labels, or semantic HTML structure\n"
|
||||
summary += " 3. Ensure instructions work for users who cannot perceive color, shape, size, or sound\n"
|
||||
summary += " 4. Example: Instead of \"Click the red button\", use \"Click the Submit button (red)\"\n\n"
|
||||
}
|
||||
|
||||
// Add WCAG references
|
||||
summary += "WCAG Criteria:\n"
|
||||
summary += " - WCAG 1.3.3 (Sensory Characteristics - Level A): Instructions must not rely solely on sensory characteristics\n"
|
||||
summary += " - Instructions should use multiple cues (text + color, label + position, etc.)\n"
|
||||
summary += " - Users with visual, auditory, or cognitive disabilities must be able to understand instructions\n\n"
|
||||
|
||||
summary += fmt.Sprintf("Full Results:\n%s", string(resultJSON))
|
||||
|
||||
return &mcp.CallToolResult{
|
||||
Content: []mcp.Content{
|
||||
mcp.NewTextContent(summary),
|
||||
},
|
||||
IsError: false,
|
||||
}, nil
|
||||
})
|
||||
|
||||
// Register web_animation_flash tool
|
||||
mcpServer.AddTool(mcp.Tool{
|
||||
Name: "web_animation_flash_cremotemcp",
|
||||
|
||||
Reference in New Issue
Block a user