new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

MCP · Building servers and clients · all subjects

client: ruby

2 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Ruby MCP client: MCP::Client::Stdio transport

The Ruby client uses `@transport = MCP::Client::Stdio.new(command: command, args: [server_script_path])`, then `@mcp_client = MCP::Client.new(transport: @transport)` and `@mcp_client.connect`. Tools are read from `@mcp_client.tools` with `name`, `description`, `input_schema`; calls are `@mcp_client.call_tool(name:, arguments:)` and the result content is extracted with `result.dig("result", "content")`. The transport must be closed explicitly (`@transport&.close`) in an `ensure` block. Requires Ruby 3.2.0+ and gems anthropic, base64, dotenv, mcp.

Ruby MCP server: MCP::Tool subclasses and StdioTransport

With the Ruby `mcp` gem (Ruby 2.7+), each tool is a subclass of `MCP::Tool` declaring `tool_name "get_alerts"`, `description "..."` and `input_schema(properties: { state: { type: "string", description: "..." } }, required: ["state"])`, implementing `def self.call(state:)` and returning `MCP::Tool::Response.new([{ type: "text", text: ... }])`. Start the server with `MCP::Server.new(name: "weather", version: "1.0.0", tools: [GetAlerts, GetForecast])` followed by `MCP::Server::Transports::StdioTransport.new(server).open`.

Give your agent this brain