import { GetPromptResult } from "@modelcontextprotocol/sdk/types";
import { contentfulHandlers } from "./promptHandlers/contentful";
import { aiActionsHandlers } from "./promptHandlers/aiActions";
/**
* Handle a prompt request and return the appropriate response
* @param name Prompt name
* @param args Optional arguments provided for the prompt
* @returns Prompt result with messages
*/
export async function handlePrompt(
name: string,
args?: Record<string, string>,
): Promise<GetPromptResult> {
// Check for AI Actions handlers
if (name.startsWith("ai-actions-") && name in aiActionsHandlers) {
return aiActionsHandlers[name as keyof typeof aiActionsHandlers](args);
}
// Check for general Contentful handlers
if (name in contentfulHandlers) {
return contentfulHandlers[name as keyof typeof contentfulHandlers](args);
}
// Handle unknown prompts
throw new Error(`Unknown prompt: ${name}`);
}
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ivo-toby/contentful-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server