mcp-console

This commit is contained in:
Josh at WLTechBlog 2025-08-15 09:11:15 -05:00
parent efab3cc11e
commit 04eea10aa5
2 changed files with 4 additions and 32 deletions

Binary file not shown.

View File

@ -707,38 +707,10 @@ func main() {
Required: []string{},
},
}, func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
// Convert arguments to map
params, ok := request.Params.Arguments.(map[string]any)
if !ok {
return nil, fmt.Errorf("invalid arguments format")
}
tab := getStringParam(params, "tab", cremoteServer.currentTab)
clear := getBoolParam(params, "clear", false)
// Get console logs
logs, err := cremoteServer.client.GetConsoleLogs(tab, clear)
if err != nil {
return nil, fmt.Errorf("failed to get console logs: %w", err)
}
// Format logs for display
var logText string
if len(logs) == 0 {
logText = "No console logs found."
} else {
logText = fmt.Sprintf("Found %d console log entries:\n\n", len(logs))
for i, log := range logs {
level := log["level"].(string)
message := log["message"].(string)
timestamp := log["timestamp"].(string)
logText += fmt.Sprintf("[%d] %s [%s]: %s\n", i+1, timestamp, level, message)
}
}
// For now, return a placeholder since we need to implement console logging in daemon
return &mcp.CallToolResult{
Content: []mcp.Content{
mcp.NewTextContent(logText),
mcp.NewTextContent("Console logging not yet implemented - please use console_command for now"),
},
IsError: false,
}, nil
@ -782,8 +754,8 @@ func main() {
return nil, fmt.Errorf("command parameter is required")
}
// Execute console command
result, err := cremoteServer.client.ExecuteConsoleCommand(tab, command, timeout)
// Execute console command using existing EvalJS functionality
result, err := cremoteServer.client.EvalJS(tab, command, timeout)
if err != nil {
return nil, fmt.Errorf("failed to execute console command: %w", err)
}