UNPKG

dataforseo-mcp-server

Version:

CLI and MCP server for DataForSEO API — browse documentation and make authenticated API requests

25 lines • 882 B
import { z } from "zod"; import { DEFAULT_READ_ONLY_TOOL_ANNOTATIONS } from "./tool-annotations.js"; import { errorResult } from "./types.js"; export class BaseTool { getAnnotations() { return DEFAULT_READ_ONLY_TOOL_ANNOTATIONS; } async invoke(args) { try { const input = this.schema.parse(args); return await this.execute(input); } catch (error) { if (error instanceof z.ZodError) { const details = error.issues .map((issue) => `${issue.path.join(".")}: ${issue.message}`) .join("; "); return errorResult(`Invalid input: ${details}`); } const message = error instanceof Error ? error.message : String(error); return errorResult(message); } } } //# sourceMappingURL=base-tool.js.map