systemprompt-mcp-core
Version:
A specialized Model Context Protocol (MCP) server that integrates with systemprompt.io to provide powerful prompt management capabilities. This server enables seamless creation, management, and versioning of system prompts and agents through MCP. It works
27 lines • 927 B
JavaScript
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