Files
herolib/lib/ai/mcp/handler_logging.v
Mahmoud-Emad 10ce2ca1cd refactor: introduce mcpcore and clean up STDIO transport
- Extract core MCP logic into a new `mcpcore` module
- Remove logging that interferes with JSON-RPC over STDIO
- Improve server loop to parse requests before handling
- Add stub for `logging/setLevel` JSON-RPC method
- Refactor vcode server into a dedicated logic submodule
2025-09-15 11:59:24 +03:00

38 lines
1.1 KiB
V

module mcp
import x.json2
import freeflowuniverse.herolib.schemas.jsonrpc
// LogLevel represents the logging levels supported by MCP
pub enum LogLevel {
debug
info
notice
warning
error
critical
alert
emergency
}
// SetLevelParams represents the parameters for the logging/setLevel method
pub struct SetLevelParams {
pub:
level LogLevel
}
// logging_set_level_handler handles the logging/setLevel request
// This is a stub implementation that accepts the request but doesn't actually change logging behavior
pub fn logging_set_level_handler(data string) !string {
// Decode the request with SetLevelParams
request := jsonrpc.decode_request_generic[SetLevelParams](data)!
// For now, we just acknowledge the request without actually implementing logging level changes
// In a full implementation, this would configure the server's logging system
// Create a success response with empty object (logging/setLevel returns {} on success)
empty_map := map[string]string{}
response := jsonrpc.new_response_generic[map[string]string](request.id, empty_map)
return response.encode()
}