feat(mcp): add ping request handling

This commit is contained in:
evalstate
2026-03-14 17:48:29 +00:00
parent 42bb2f3c58
commit 93ea95af24
3 changed files with 64 additions and 7 deletions

View File

@@ -116,3 +116,24 @@ test "MCP.Server - Integration: synchronous smoke test" {
try testing.expectJson(.{ .id = 1 }, out_alloc.writer.buffered());
}
test "MCP.Server - Integration: ping request returns an empty result" {
defer testing.reset();
const allocator = testing.allocator;
const app = testing.test_app;
const input =
\\{"jsonrpc":"2.0","id":"ping-1","method":"ping"}
;
var in_reader: std.io.Reader = .fixed(input);
var out_alloc: std.io.Writer.Allocating = .init(testing.arena_allocator);
defer out_alloc.deinit();
var server = try Self.init(allocator, app, &out_alloc.writer);
defer server.deinit();
try router.processRequests(server, &in_reader);
try testing.expectJson(.{ .id = "ping-1", .result = .{} }, out_alloc.writer.buffered());
}