mcp: use declarative static definitions for tools and resources

This commit is contained in:
Adrià Arrufat
2026-03-01 21:56:48 +09:00
parent 952dfbef36
commit e9c36fd6f8
4 changed files with 108 additions and 117 deletions

View File

@@ -94,7 +94,17 @@ pub const ToolsCapability = struct {
pub const Tool = struct {
name: []const u8,
description: ?[]const u8 = null,
inputSchema: std.json.Value,
inputSchema: RawJson,
};
pub const RawJson = struct {
json: []const u8,
pub fn jsonStringify(self: @This(), jw: anytype) !void {
try jw.beginWriteRaw();
try jw.writer.writeAll(self.json);
jw.endWriteRaw();
}
};
pub const Resource = struct {