mcp: handle missing request IDs safely

This commit is contained in:
Adrià Arrufat
2026-03-27 11:34:06 +09:00
parent c8d8ca5e94
commit de32e5cf34
3 changed files with 6 additions and 3 deletions

View File

@@ -172,7 +172,8 @@ pub const tool_list = [_]protocol.Tool{
pub fn handleList(server: *Server, arena: std.mem.Allocator, req: protocol.Request) !void {
_ = arena;
try server.sendResult(req.id.?, .{ .tools = &tool_list });
const id = req.id orelse return;
try server.sendResult(id, .{ .tools = &tool_list });
}
const GotoParams = struct {