mcp-console
This commit is contained in:
parent
efab3cc11e
commit
04eea10aa5
BIN
mcp/cremote-mcp
BIN
mcp/cremote-mcp
Binary file not shown.
36
mcp/main.go
36
mcp/main.go
|
@ -707,38 +707,10 @@ func main() {
|
||||||
Required: []string{},
|
Required: []string{},
|
||||||
},
|
},
|
||||||
}, func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
}, func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
||||||
// Convert arguments to map
|
// For now, return a placeholder since we need to implement console logging in daemon
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return &mcp.CallToolResult{
|
return &mcp.CallToolResult{
|
||||||
Content: []mcp.Content{
|
Content: []mcp.Content{
|
||||||
mcp.NewTextContent(logText),
|
mcp.NewTextContent("Console logging not yet implemented - please use console_command for now"),
|
||||||
},
|
},
|
||||||
IsError: false,
|
IsError: false,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -782,8 +754,8 @@ func main() {
|
||||||
return nil, fmt.Errorf("command parameter is required")
|
return nil, fmt.Errorf("command parameter is required")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute console command
|
// Execute console command using existing EvalJS functionality
|
||||||
result, err := cremoteServer.client.ExecuteConsoleCommand(tab, command, timeout)
|
result, err := cremoteServer.client.EvalJS(tab, command, timeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to execute console command: %w", err)
|
return nil, fmt.Errorf("failed to execute console command: %w", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue