mcp: improve evaluate error reporting and refactor tool result types

This commit is contained in:
Adrià Arrufat
2026-03-03 15:17:59 +09:00
parent f982f073df
commit 48df38cbfe
3 changed files with 98 additions and 29 deletions

View File

@@ -149,6 +149,20 @@ pub const Resource = struct {
mimeType: ?[]const u8 = null,
};
pub fn TextContent(comptime T: type) type {
return struct {
type: []const u8 = "text",
text: T,
};
}
pub fn CallToolResult(comptime T: type) type {
return struct {
content: []const TextContent(T),
isError: bool = false,
};
}
pub const JsonEscapingWriter = struct {
inner_writer: *std.Io.Writer,
writer: std.Io.Writer,