UNPKG

mcp-server-ddd-sample

Version:

A sample of MCP implementation using DDD structure with some APIs call.

28 lines (27 loc) 868 B
import { z } from "zod"; import { BaseToolsController } from "./base/BaseToolsController.js"; export class BlockToolsController extends BaseToolsController { service; constructor(server, service) { super(server); this.service = service; } registerTools() { this.registerGetRecommendedFeesHandler(); } registerGetRecommendedFeesHandler() { this.server.tool("get-block", "Returns details about a block from hash", { hash: z.string().length(64).describe("The hash info to get block"), }, async ({ hash }) => { const text = await this.service.getBlock({ hash }); return { content: [ { type: "text", text: text, }, ], }; }); } }