import { deriveDisplayedContentTypeMcpToolDefinitions } from './derive-content-type-mcp-tools.mjs'; import { getService } from '../utils/index.mjs'; /** * Registers derived content-type MCP tools via strapi.ai.mcp.registerTool(). * Must be called from the plugin register phase, before the MCP HTTP server starts. */ const registerContentManagerMcpTools = async ({ strapi })=>{ // Performance only: registerTool() is safe when MCP is disabled (definitions are stored but // never exposed). Skip the expensive derivation below when the MCP server will not start. if (strapi.ai.mcp.isEnabled() !== true) { return; } const i18nPlugin = strapi.plugin('i18n'); let localeCodes = null; let defaultLocale = null; if (i18nPlugin !== undefined) { localeCodes = (await i18nPlugin.service('locales').find()).map((locale)=>locale.code); defaultLocale = await i18nPlugin.service('locales').getDefaultLocale(); } const models = getService('content-types').findDisplayedContentTypes(); const tools = deriveDisplayedContentTypeMcpToolDefinitions(strapi, models, { localeCodes, defaultLocale }); for (const tool of tools){ strapi.ai.mcp.registerTool(tool); } }; export { registerContentManagerMcpTools }; //# sourceMappingURL=register-content-manager-mcp-tools.mjs.map