UNPKG

systemprompt-mcp-gmail

Version:

A specialized Model Context Protocol (MCP) server that enables you to search, read, delete and send emails from your Gmail account, leveraging an AI Agent to help with each operation.

27 lines 927 B
import { TOOLS } from "../constants/tools.js"; import { validateWithErrors } from "./validation.js"; /** * Validates a tool request and returns the tool configuration if valid */ export function validateToolRequest(request) { if (!request.params?.name) { throw new Error("Invalid tool request: missing tool name"); } const tool = TOOLS.find((t) => t.name === request.params.name); if (!tool) { throw new Error(`Unknown tool: ${request.params.name}`); } // Validate arguments against the tool's schema if present if (tool.inputSchema && request.params.arguments) { validateWithErrors(request.params.arguments, tool.inputSchema); } return tool; } /** * Gets the schema for a tool by name */ export function getToolSchema(toolName) { const tool = TOOLS.find((t) => t.name === toolName); return tool?.inputSchema; } //# sourceMappingURL=tool-validation.js.map