mcp: simplify handleList implementations

This commit is contained in:
Adrià Arrufat
2026-03-02 21:30:47 +09:00
parent 78edf6d324
commit 43785bfab4
2 changed files with 2 additions and 14 deletions

View File

@@ -22,13 +22,7 @@ pub const resource_list = [_]protocol.Resource{
}; };
pub fn handleList(server: *Server, req: protocol.Request) !void { pub fn handleList(server: *Server, req: protocol.Request) !void {
const result = struct { try server.sendResult(req.id.?, .{ .resources = &resource_list });
resources: []const protocol.Resource,
}{
.resources = &resource_list,
};
try server.sendResult(req.id.?, result);
} }
const ReadParams = struct { const ReadParams = struct {

View File

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