Skip to content

v0.4.0

Choose a tag to compare

@PaytonWebber PaytonWebber released this 10 Jun 18:55
· 7 commits to main since this release
v0.4.0
9a03256

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.

  • ToolContext for 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 isError results.
  • types.parseArgs accepts 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