Repository navigation
v0.4.0
Highlights
mcp.ToolPack: one declaration per tool.
fn hello(allocator: Allocator, args: HelloArgs) !types.CallToolResult {
const msg = try std.fmt.allocPrint(allocator, "Hello, {s}!", .{args.name});
return types.CallToolResult.text(allocator, msg);
}
const MyTools = mcp.ToolPack(.{
.hello = .{ .description = "Say hello", .handler = hello },
});That is a complete tool server: the JSON Schema, the tools/list entry, name dispatch, and typed argument parsing are generated at compile time from the handler's signature. The pack implements listTools/callTool, so it works directly as a Server handler or embedded in a larger one.
ToolContextfor handlers that report progress:tc.sendProgress(i, total)is a no-op when the client sent no progress token. Over HTTP, progress streams on the POST's own SSE response.- Composition:
ToolPack(.{ lib_a.tool_defs, my_defs })merges def groups, so libraries can export tools without owning a server binary. Duplicate names are a compile error. - Unknown tools and failed argument validation return descriptive
isErrorresults. types.parseArgsaccepts absent arguments when every field has a default.
No breaking changes; hand-written listTools/callTool handlers keep working. Both greeter examples now use packs.
See CHANGELOG.md.
Install
zig fetch --save https://github.com/PaytonWebber/zig-mcp-sdk/archive/refs/tags/v0.4.0.tar.gz