@intlayer/mcp 9.5.3 → 9.5.4-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <p align="center">
2
2
  <a href="https://intlayer.org" rel="">
3
- <img src="https://raw.githubusercontent.com/aymericzip/intlayer/main/docs/assets/cover.png" width="60%" alt="Intlayer Logo" />
3
+ <img src="https://raw.githubusercontent.com/aymericzip/intlayer/main/docs/assets/cover.webp" width="60%" alt="Intlayer Logo" />
4
4
  </a>
5
5
  </p>
6
6
 
@@ -49,10 +49,10 @@ With **per-locale content files**, **TypeScript autocompletion**, **tree-shakabl
49
49
 
50
50
  | Feature | Description |
51
51
  | --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more. |
52
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.webp?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more. |
53
53
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content) |
54
54
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **Per-Locale Content Declaration File**<br><br>Speed up your development by declaring your content once, before auto generation.<br><br> - [Per-Locale Content Declaration File](https://intlayer.org/doc/concept/per-locale-file) |
55
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/compiler.jpg?raw=true" alt="Feature" width="700"> | **Compiler**<br><br>The Intlayer Compiler extract automatically the content from the components and generate the dictionary files.<br><br> - [Compiler](https://intlayer.org/doc/compiler) |
55
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/compiler.webp?raw=true" alt="Feature" width="700"> | **Compiler**<br><br>The Intlayer Compiler extract automatically the content from the components and generate the dictionary files.<br><br> - [Compiler](https://intlayer.org/doc/compiler) |
56
56
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true" alt="Feature" width="700"> | **Type-Safe Environment**<br><br>Leverage TypeScript to ensure your content definitions and code are error-free, while also benefiting from IDE autocompletion.<br><br> - [TypeScript configuration](https://intlayer.org/doc/environment/vite-and-react#configure-typescript) |
57
57
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/config_file.png?raw=true" alt="Feature" width="700"> | **Simplified Setup**<br><br>Get up and running quickly with minimal configuration. Adjust settings for internationalization, routing, AI, build, and content handling with ease. <br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
58
58
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/content_retrieval.png?raw=true" alt="Feature" width="700"> | **Simplified Content Retrieval**<br><br>No need to call your `t` function for each piece of content. Retrieve all your content directly using a single hook.<br><br> - [React integration](https://intlayer.org/doc/environment/create-react-app) |
@@ -60,12 +60,12 @@ With **per-locale content files**, **TypeScript autocompletion**, **tree-shakabl
60
60
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/file_tree.png?raw=true" alt="Feature" width="700"> | **Organized Codebase**<br><br>Keep your codebase more organized: 1 component = 1 dictionary in the same folder. Translations close to their respective components, enhance maintainability and clarity. <br><br> - [How Intlayer works](https://intlayer.org/doc/concept/how-works-intlayer) |
61
61
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/url_routing.png?raw=true" alt="Feature" width="700"> | **Enhanced Routing**<br><br>Full support of app routing, adapting seamlessly to complex application structures, for Next.js, React, Vite, Vue.js, etc.<br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
62
62
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/markdown.png?raw=true" alt="Feature" width="700"> | **Markdown Support**<br><br>Import and interpret, locale files and remote Markdown for multilingual content like privacy policies, documentation, etc. Interpret and make Markdown metadata accessible in your code.<br><br> - [Content files](https://intlayer.org/doc/concept/content/file) |
63
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/visual_editor.png?raw=true" alt="Feature" width="700"> | **Free Visual Editor & CMS**<br><br>A free visual editor and CMS are available for content writers, removing the need for a localization platform. Keep your content synchronized using Git, or externalize it totally or partially with the CMS.<br><br> - [Intlayer Editor](https://intlayer.org/doc/concept/editor) <br> - [Intlayer CMS](https://intlayer.org/doc/concept/cms) |
64
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle.png?raw=true" alt="Feature" width="700"> | **Tree-shakable Content**<br><br>Tree-shakable content, reducing the size of the final bundle. Loads content per component, excluding any unused content from your bundle. Supports lazy loading to enhance app loading efficiency. <br><br> - [App build optimization](https://intlayer.org/doc/concept/how-works-intlayer#app-build-optimization) |
65
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/static_rendering.png?raw=true" alt="Feature" width="700"> | **Static Rendering**<br><br>Doesn't block Static Rendering. <br><br> - [Next.js integration](https://intlayer.org/doc/environment/nextjs) |
63
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/visual_editor.webp?raw=true" alt="Feature" width="700"> | **Free Visual Editor & CMS**<br><br>A free visual editor and CMS are available for content writers, removing the need for a localization platform. Keep your content synchronized using Git, or externalize it totally or partially with the CMS.<br><br> - [Intlayer Editor](https://intlayer.org/doc/concept/editor) <br> - [Intlayer CMS](https://intlayer.org/doc/concept/cms) |
64
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle.webp?raw=true" alt="Feature" width="700"> | **Tree-shakable Content**<br><br>Tree-shakable content, reducing the size of the final bundle. Loads content per component, excluding any unused content from your bundle. Supports lazy loading to enhance app loading efficiency. <br><br> - [App build optimization](https://intlayer.org/doc/concept/how-works-intlayer#app-build-optimization) |
65
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/static_rendering.webp?raw=true" alt="Feature" width="700"> | **Static Rendering**<br><br>Doesn't block Static Rendering. <br><br> - [Next.js integration](https://intlayer.org/doc/environment/nextjs) |
66
66
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/AI_translation.png?raw=true" alt="Feature" width="700"> | **AI-Powered Translation**<br><br>Transform your website into 231 languages with just one click using Intlayer's advanced AI-powered translation tools using your own AI provider / API key. <br><br> - [CI/CD integration](https://intlayer.org/doc/concept/ci-cd) <br> - [Intlayer CLI](https://intlayer.org/doc/concept/cli) <br> - [Auto fill](https://intlayer.org/doc/concept/auto-fill) |
67
67
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/mcp.png?raw=true" alt="Feature" width="700"> | **MCP Server Integration**<br><br>Provides an MCP (Model Context Protocol) server for IDE automation, enabling seamless content management and i18n workflows directly within your development environment. <br><br> - [MCP Server](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/mcp_server.md) |
68
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/vscode_extension.png?raw=true" alt="Feature" width="700"> | **VSCode Extension**<br><br>Intlayer provides a VSCode extension to help you manage your content and translations, building your dictionaries, translating your content, and more. <br><br> - [VSCode Extension](https://intlayer.org/doc/vs-code-extension) |
68
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/vscode_extension.webp?raw=true" alt="Feature" width="700"> | **VSCode Extension**<br><br>Intlayer provides a VSCode extension to help you manage your content and translations, building your dictionaries, translating your content, and more. <br><br> - [VSCode Extension](https://intlayer.org/doc/vs-code-extension) |
69
69
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/interoperability.png?raw=true" alt="Feature" width="700"> | **Interoperability**<br><br>Allow interoperability with react-i18next, next-i18next, next-intl, react-intl, vue-i18n. <br><br> - [Intlayer and react-intl](https://intlayer.org/blog/intlayer-with-react-intl) <br> - [Intlayer and next-intl](https://intlayer.org/blog/intlayer-with-next-intl) <br> - [Intlayer and next-i18next](https://intlayer.org/blog/intlayer-with-next-i18next) <br> - [Intlayer and vue-i18n](https://intlayer.org/blog/intlayer-with-vue-i18n) <br> - [Intlayer compat adapters](https://intlayer.org/doc/compatibility) |
70
70
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/benchmark.png?raw=true" alt="Feature" width="700"> | **Performances & Benchmark**<br><br>Uses advanced tree-shaking and dynamic loading to boost performances and keep the solution as light as possible. <br><br> - [Performances & Benchmark](https://intlayer.org/doc/benchmark) |
71
71
 
@@ -262,7 +262,7 @@ Intlayer connects **developers**, **copywriters**, and **AI agents** in one work
262
262
  - Feature flags
263
263
  - Headless CMSs (e.g. Contentful, Strapi, Sanity)
264
264
 
265
- ![CMS Preview](https://github.com/aymericzip/intlayer/blob/main/docs/assets/CMS.png?raw=true)
265
+ ![CMS Preview](https://github.com/aymericzip/intlayer/blob/main/docs/assets/CMS.webp?raw=true)
266
266
 
267
267
  ## 🌐 Readme in other languages
268
268
 
@@ -1,7 +1,7 @@
1
1
  import { dirname as dirname$1 } from "node:path";
2
+ import { createMCPClient } from "@ai-sdk/mcp";
2
3
  import { fileURLToPath } from "node:url";
3
4
  import { isESModule } from "@intlayer/config/utils";
4
- import { createMCPClient } from "@ai-sdk/mcp";
5
5
 
6
6
  //#region src/client/client.ts
7
7
  const dirname = isESModule ? dirname$1(fileURLToPath(import.meta.url)) : __dirname;
@@ -1,13 +1,13 @@
1
- import { loadInstallLSPTool } from "../tools/installLSP.mjs";
2
- import { loadCLITools } from "../tools/cli.mjs";
3
1
  import { loadAPITools } from "../tools/api.mjs";
4
- import { loadInstallSkillsTool } from "../tools/installSkills.mjs";
2
+ import { loadCLITools } from "../tools/cli.mjs";
5
3
  import { loadDocsTools } from "../tools/docs.mjs";
6
- import z from "zod";
4
+ import { loadInstallLSPTool } from "../tools/installLSP.mjs";
5
+ import { loadInstallSkillsTool } from "../tools/installSkills.mjs";
6
+ import { z } from "zod/mini";
7
7
  import { dirname as dirname$1, resolve } from "node:path";
8
- import { readFileSync } from "node:fs";
9
8
  import { fileURLToPath } from "node:url";
10
9
  import { isESModule } from "@intlayer/config/utils";
10
+ import { readFileSync } from "node:fs";
11
11
 
12
12
  //#region src/server/server.ts
13
13
  const dirname = isESModule ? dirname$1(fileURLToPath(import.meta.url)) : __dirname;
@@ -1 +1 @@
1
- {"version":3,"file":"server.mjs","names":["pathDirname"],"sources":["../../../src/server/server.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { dirname as pathDirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isESModule } from '@intlayer/config/utils';\nimport z from 'zod';\nimport { loadAPITools } from '../tools/api';\nimport { loadCLITools } from '../tools/cli';\nimport { loadDocsTools } from '../tools/docs';\nimport { loadInstallLSPTool } from '../tools/installLSP';\nimport { loadInstallSkillsTool } from '../tools/installSkills';\n\nexport const dirname: string = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nconst packageJson: Record<string, any> = JSON.parse(\n readFileSync(resolve(dirname, '../../../package.json'), 'utf8')\n);\n\ntype ToolResult = {\n content: { type: string; text: string }[];\n isError?: boolean;\n};\n\ntype StoredTool = {\n name: string;\n description?: string;\n annotations?: Record<string, any>;\n inputSchema: Record<string, any>;\n handler: (params: any) => Promise<ToolResult>;\n};\n\nexport interface McpTransport {\n start(server: McpServer): Promise<void>;\n}\n\nexport class McpServer {\n private readonly _tools = new Map<string, StoredTool>();\n private readonly _info: { name: string; version: string };\n\n constructor(info: { name: string; version: string }) {\n this._info = info;\n }\n\n registerTool(\n name: string,\n config: {\n title?: string;\n description?: string;\n inputSchema?: Record<string, any>;\n annotations?: Record<string, any>;\n },\n handler: (params: any) => Promise<ToolResult>\n ): void {\n const shape = config.inputSchema ?? {};\n let inputSchema: Record<string, any>;\n try {\n inputSchema = z.toJSONSchema(z.object(shape)) as Record<string, any>;\n } catch {\n inputSchema = { type: 'object', properties: {} };\n }\n this._tools.set(name, {\n name,\n description: config.description,\n annotations: config.annotations,\n inputSchema,\n handler,\n });\n }\n\n async handleMessage(message: any): Promise<any> {\n const { id, method, params } = message;\n const isNotification = id === undefined;\n\n switch (method) {\n case 'initialize':\n return {\n jsonrpc: '2.0',\n id,\n result: {\n protocolVersion: '2024-11-05',\n capabilities: { tools: {} },\n serverInfo: this._info,\n },\n };\n\n case 'tools/list':\n return {\n jsonrpc: '2.0',\n id,\n result: {\n tools: Array.from(this._tools.values()).map((t) => ({\n name: t.name,\n description: t.description,\n inputSchema: t.inputSchema,\n ...(t.annotations && { annotations: t.annotations }),\n })),\n },\n };\n\n case 'tools/call': {\n const { name, arguments: args } = params ?? {};\n const tool = this._tools.get(name);\n if (!tool) {\n if (isNotification) return null;\n return {\n jsonrpc: '2.0',\n id,\n error: { code: -32601, message: `Tool not found: ${name}` },\n };\n }\n try {\n const result = await tool.handler(args ?? {});\n if (isNotification) return null;\n return { jsonrpc: '2.0', id, result };\n } catch (error) {\n if (isNotification) return null;\n return {\n jsonrpc: '2.0',\n id,\n error: {\n code: -32000,\n message: error instanceof Error ? error.message : String(error),\n },\n };\n }\n }\n\n case 'ping':\n if (isNotification) return null;\n return { jsonrpc: '2.0', id, result: {} };\n\n default:\n if (isNotification) return null;\n return {\n jsonrpc: '2.0',\n id,\n error: { code: -32601, message: `Method not found: ${method}` },\n };\n }\n }\n\n async connect(transport: McpTransport): Promise<void> {\n await transport.start(this);\n }\n}\n\ntype LoadServer = (options: { isLocal: boolean }) => McpServer;\n\nexport const loadServer: LoadServer = ({ isLocal }) => {\n const server = new McpServer({\n name: 'intlayer',\n version: packageJson.version,\n });\n\n if (isLocal) {\n try {\n loadCLITools(server);\n loadInstallSkillsTool(server);\n loadInstallLSPTool(server);\n } catch (error) {\n console.error('Error loading CLI tools:', error);\n }\n }\n\n try {\n loadDocsTools(server);\n } catch (error) {\n console.error('Error loading docs tools:', error);\n }\n\n try {\n loadAPITools(server);\n } catch (error) {\n console.error('Error loading API tools:', error);\n }\n\n return server;\n};\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,UAAkB,aAC3BA,UAAY,cAAc,YAAY,GAAG,CAAC,IAC1C;AAEJ,MAAM,cAAmC,KAAK,MAC5C,aAAa,QAAQ,SAAS,uBAAuB,GAAG,MAAM,CAChE;AAmBA,IAAa,YAAb,MAAuB;CACrB,AAAiB,yBAAS,IAAI,IAAwB;CACtD,AAAiB;CAEjB,YAAY,MAAyC;EACnD,KAAK,QAAQ;CACf;CAEA,aACE,MACA,QAMA,SACM;EACN,MAAM,QAAQ,OAAO,eAAe,CAAC;EACrC,IAAI;EACJ,IAAI;GACF,cAAc,EAAE,aAAa,EAAE,OAAO,KAAK,CAAC;EAC9C,QAAQ;GACN,cAAc;IAAE,MAAM;IAAU,YAAY,CAAC;GAAE;EACjD;EACA,KAAK,OAAO,IAAI,MAAM;GACpB;GACA,aAAa,OAAO;GACpB,aAAa,OAAO;GACpB;GACA;EACF,CAAC;CACH;CAEA,MAAM,cAAc,SAA4B;EAC9C,MAAM,EAAE,IAAI,QAAQ,WAAW;EAC/B,MAAM,iBAAiB,OAAO;EAE9B,QAAQ,QAAR;GACE,KAAK,cACH,OAAO;IACL,SAAS;IACT;IACA,QAAQ;KACN,iBAAiB;KACjB,cAAc,EAAE,OAAO,CAAC,EAAE;KAC1B,YAAY,KAAK;IACnB;GACF;GAEF,KAAK,cACH,OAAO;IACL,SAAS;IACT;IACA,QAAQ,EACN,OAAO,MAAM,KAAK,KAAK,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO;KAClD,MAAM,EAAE;KACR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EACd,QAAQ,MAAM,6BAA6B,KAAK;CAClD;CAEA,IAAI;EACF,aAAa,MAAM;CACrB,SAAS,OAAO;EACd,QAAQ,MAAM,4BAA4B,KAAK;CACjD;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"server.mjs","names":["pathDirname"],"sources":["../../../src/server/server.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { dirname as pathDirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isESModule } from '@intlayer/config/utils';\nimport { z } from 'zod/mini';\nimport { loadAPITools } from '../tools/api';\nimport { loadCLITools } from '../tools/cli';\nimport { loadDocsTools } from '../tools/docs';\nimport { loadInstallLSPTool } from '../tools/installLSP';\nimport { loadInstallSkillsTool } from '../tools/installSkills';\n\nexport const dirname: string = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nconst packageJson: Record<string, any> = JSON.parse(\n readFileSync(resolve(dirname, '../../../package.json'), 'utf8')\n);\n\ntype ToolResult = {\n content: { type: string; text: string }[];\n isError?: boolean;\n};\n\ntype StoredTool = {\n name: string;\n description?: string;\n annotations?: Record<string, any>;\n inputSchema: Record<string, any>;\n handler: (params: any) => Promise<ToolResult>;\n};\n\nexport interface McpTransport {\n start(server: McpServer): Promise<void>;\n}\n\nexport class McpServer {\n private readonly _tools = new Map<string, StoredTool>();\n private readonly _info: { name: string; version: string };\n\n constructor(info: { name: string; version: string }) {\n this._info = info;\n }\n\n registerTool(\n name: string,\n config: {\n title?: string;\n description?: string;\n inputSchema?: Record<string, any>;\n annotations?: Record<string, any>;\n },\n handler: (params: any) => Promise<ToolResult>\n ): void {\n const shape = config.inputSchema ?? {};\n let inputSchema: Record<string, any>;\n try {\n inputSchema = z.toJSONSchema(z.object(shape)) as Record<string, any>;\n } catch {\n inputSchema = { type: 'object', properties: {} };\n }\n this._tools.set(name, {\n name,\n description: config.description,\n annotations: config.annotations,\n inputSchema,\n handler,\n });\n }\n\n async handleMessage(message: any): Promise<any> {\n const { id, method, params } = message;\n const isNotification = id === undefined;\n\n switch (method) {\n case 'initialize':\n return {\n jsonrpc: '2.0',\n id,\n result: {\n protocolVersion: '2024-11-05',\n capabilities: { tools: {} },\n serverInfo: this._info,\n },\n };\n\n case 'tools/list':\n return {\n jsonrpc: '2.0',\n id,\n result: {\n tools: Array.from(this._tools.values()).map((t) => ({\n name: t.name,\n description: t.description,\n inputSchema: t.inputSchema,\n ...(t.annotations && { annotations: t.annotations }),\n })),\n },\n };\n\n case 'tools/call': {\n const { name, arguments: args } = params ?? {};\n const tool = this._tools.get(name);\n if (!tool) {\n if (isNotification) return null;\n return {\n jsonrpc: '2.0',\n id,\n error: { code: -32601, message: `Tool not found: ${name}` },\n };\n }\n try {\n const result = await tool.handler(args ?? {});\n if (isNotification) return null;\n return { jsonrpc: '2.0', id, result };\n } catch (error) {\n if (isNotification) return null;\n return {\n jsonrpc: '2.0',\n id,\n error: {\n code: -32000,\n message: error instanceof Error ? error.message : String(error),\n },\n };\n }\n }\n\n case 'ping':\n if (isNotification) return null;\n return { jsonrpc: '2.0', id, result: {} };\n\n default:\n if (isNotification) return null;\n return {\n jsonrpc: '2.0',\n id,\n error: { code: -32601, message: `Method not found: ${method}` },\n };\n }\n }\n\n async connect(transport: McpTransport): Promise<void> {\n await transport.start(this);\n }\n}\n\ntype LoadServer = (options: { isLocal: boolean }) => McpServer;\n\nexport const loadServer: LoadServer = ({ isLocal }) => {\n const server = new McpServer({\n name: 'intlayer',\n version: packageJson.version,\n });\n\n if (isLocal) {\n try {\n loadCLITools(server);\n loadInstallSkillsTool(server);\n loadInstallLSPTool(server);\n } catch (error) {\n console.error('Error loading CLI tools:', error);\n }\n }\n\n try {\n loadDocsTools(server);\n } catch (error) {\n console.error('Error loading docs tools:', error);\n }\n\n try {\n loadAPITools(server);\n } catch (error) {\n console.error('Error loading API tools:', error);\n }\n\n return server;\n};\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,UAAkB,aAC3BA,UAAY,cAAc,Y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B;MAAO;KAC5D;IACF;IACA,IAAI;KACF,MAAM,SAAS,MAAM,KAAK,QAAQ,QAAQ,CAAC,CAAC;KAC5C,IAAI,gBAAgB,OAAO;KAC3B,OAAO;MAAE,SAAS;MAAO;MAAI;KAAO;IACtC,SAAS,OAAO;KACd,IAAI,gBAAgB,OAAO;KAC3B,OAAO;MACL,SAAS;MACT;MACA,OAAO;OACL,MAAM;OACN,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;MAChE;KACF;IACF;GACF;GAEA,KAAK;IACH,IAAI,gBAAgB,OAAO;IAC3B,OAAO;KAAE,SAAS;KAAO;KAAI,QAAQ,CAAC;IAAE;GAE1C;IACE,IAAI,gBAAgB,OAAO;IAC3B,OAAO;KACL,SAAS;KACT;KACA,OAAO;MAAE,MAAM;MAAQ,SAAS,qBAAqB;KAAS;IAChE;EACJ;CACF;CAEA,MAAM,QAAQ,WAAwC;EACpD,MAAM,UAAU,MAAM,IAAI;CAC5B;AACF;AAIA,MAAa,cAA0B,EAAE,cAAc;CACrD,MAAM,SAAS,IAAI,UAAU;EAC3B,MAAM;EACN,SAAS,YAAY;CACvB,CAAC;CAED,IAAI,SACF,IAAI;EACF,aAAa,MAAM;EACnB,sBAAsB,MAAM;EAC5B,mBAAmB,MAAM;CAC3B,SAAS,OAAO;EACd,QAAQ,MAAM,4BAA4B,KAAK;CACjD;CAGF,IAAI;EACF,cAAc,MAAM;CACtB,SAAS,OAAO;EACd,QAAQ,MAAM,6BAA6B,KAAK;CAClD;CAEA,IAAI;EACF,aAAa,MAAM;CACrB,SAAS,OAAO;EACd,QAAQ,MAAM,4BAA4B,KAAK;CACjD;CAEA,OAAO;AACT"}
@@ -1,12 +1,12 @@
1
- import z from "zod";
2
1
  import { getIntlayerAPI } from "@intlayer/api";
3
2
  import { editor } from "@intlayer/config/built";
4
3
  import { getEditorClientSecret } from "@intlayer/config/secrets";
4
+ import { z } from "zod/mini";
5
5
 
6
6
  //#region src/tools/api.ts
7
7
  const authSchema = {
8
- clientId: z.string().optional().describe("Intlayer OAuth2 client ID (access key). Falls back to INTLAYER_CLIENT_ID env var."),
9
- clientSecret: z.string().optional().describe("Intlayer OAuth2 client secret. Falls back to INTLAYER_CLIENT_SECRET env var.")
8
+ clientId: z.optional(z.string()).register(z.globalRegistry, { description: "Intlayer OAuth2 client ID (access key). Falls back to INTLAYER_CLIENT_ID env var." }),
9
+ clientSecret: z.optional(z.string()).register(z.globalRegistry, { description: "Intlayer OAuth2 client secret. Falls back to INTLAYER_CLIENT_SECRET env var." })
10
10
  };
11
11
  const getAPI = async (clientId, clientSecret) => {
12
12
  const resolvedClientId = clientId ?? editor.clientId;
@@ -38,8 +38,8 @@ const loadAPITools = (server) => {
38
38
  description: "List all dictionaries for the selected project. Returns keys, IDs, and metadata.",
39
39
  inputSchema: {
40
40
  ...authSchema,
41
- page: z.number().optional().describe("Page number (1-based)"),
42
- pageSize: z.number().optional().describe("Items per page")
41
+ page: z.optional(z.number()).register(z.globalRegistry, { description: "Page number (1-based)" }),
42
+ pageSize: z.optional(z.number()).register(z.globalRegistry, { description: "Items per page" })
43
43
  },
44
44
  annotations: { readOnlyHint: true }
45
45
  }, async ({ clientId, clientSecret, page, pageSize }) => {
@@ -58,7 +58,7 @@ const loadAPITools = (server) => {
58
58
  description: "Get a dictionary by its key, including its full content.",
59
59
  inputSchema: {
60
60
  ...authSchema,
61
- dictionaryKey: z.string().describe("The dictionary key")
61
+ dictionaryKey: z.string().register(z.globalRegistry, { description: "The dictionary key" })
62
62
  },
63
63
  annotations: { readOnlyHint: true }
64
64
  }, async ({ clientId, clientSecret, dictionaryKey }) => {
@@ -74,11 +74,11 @@ const loadAPITools = (server) => {
74
74
  description: "Create a new dictionary in the selected project.",
75
75
  inputSchema: {
76
76
  ...authSchema,
77
- projectId: z.string().describe("ID of the CMS project owning the dictionary. Must be the currently selected project."),
78
- key: z.string().describe("Unique key for the dictionary"),
79
- title: z.string().optional().describe("Human-readable title"),
80
- description: z.string().optional().describe("Description of the dictionary"),
81
- content: z.record(z.string(), z.unknown()).optional().describe("Initial content as JSON object")
77
+ projectId: z.string().register(z.globalRegistry, { description: "ID of the CMS project owning the dictionary. Must be the currently selected project." }),
78
+ key: z.string().register(z.globalRegistry, { description: "Unique key for the dictionary" }),
79
+ title: z.optional(z.string()).register(z.globalRegistry, { description: "Human-readable title" }),
80
+ description: z.optional(z.string()).register(z.globalRegistry, { description: "Description of the dictionary" }),
81
+ content: z.optional(z.record(z.string(), z.unknown())).register(z.globalRegistry, { description: "Initial content as JSON object" })
82
82
  },
83
83
  annotations: { destructiveHint: false }
84
84
  }, async ({ clientId, clientSecret, projectId, key, title, description, content }) => {
@@ -100,11 +100,11 @@ const loadAPITools = (server) => {
100
100
  description: "Update an existing dictionary content or metadata.",
101
101
  inputSchema: {
102
102
  ...authSchema,
103
- id: z.string().describe("Dictionary ID"),
104
- key: z.string().optional().describe("New key for the dictionary"),
105
- title: z.string().optional().describe("New title"),
106
- description: z.string().optional().describe("New description"),
107
- content: z.record(z.string(), z.unknown()).optional().describe("Updated content as JSON object")
103
+ id: z.string().register(z.globalRegistry, { description: "Dictionary ID" }),
104
+ key: z.optional(z.string()).register(z.globalRegistry, { description: "New key for the dictionary" }),
105
+ title: z.optional(z.string()).register(z.globalRegistry, { description: "New title" }),
106
+ description: z.optional(z.string()).register(z.globalRegistry, { description: "New description" }),
107
+ content: z.optional(z.record(z.string(), z.unknown())).register(z.globalRegistry, { description: "Updated content as JSON object" })
108
108
  },
109
109
  annotations: { destructiveHint: true }
110
110
  }, async ({ clientId, clientSecret, id, key, title, description, content }) => {
@@ -126,7 +126,7 @@ const loadAPITools = (server) => {
126
126
  description: "Delete a dictionary by its ID. This action is irreversible.",
127
127
  inputSchema: {
128
128
  ...authSchema,
129
- dictionaryId: z.string().describe("Dictionary ID to delete")
129
+ dictionaryId: z.string().register(z.globalRegistry, { description: "Dictionary ID to delete" })
130
130
  },
131
131
  annotations: { destructiveHint: true }
132
132
  }, async ({ clientId, clientSecret, dictionaryId }) => {
@@ -142,8 +142,8 @@ const loadAPITools = (server) => {
142
142
  description: "List all tags for the selected organization.",
143
143
  inputSchema: {
144
144
  ...authSchema,
145
- page: z.number().optional().describe("Page number (1-based)"),
146
- pageSize: z.number().optional().describe("Items per page")
145
+ page: z.optional(z.number()).register(z.globalRegistry, { description: "Page number (1-based)" }),
146
+ pageSize: z.optional(z.number()).register(z.globalRegistry, { description: "Items per page" })
147
147
  },
148
148
  annotations: { readOnlyHint: true }
149
149
  }, async ({ clientId, clientSecret, page, pageSize }) => {
@@ -162,10 +162,10 @@ const loadAPITools = (server) => {
162
162
  description: "Create a new tag in the organization. Tags can be used to group dictionaries and provide AI context.",
163
163
  inputSchema: {
164
164
  ...authSchema,
165
- key: z.string().describe("Unique tag key"),
166
- name: z.string().optional().describe("Display name for the tag"),
167
- description: z.string().optional().describe("Description of the tag"),
168
- instructions: z.string().optional().describe("AI instructions to apply when this tag is used")
165
+ key: z.string().register(z.globalRegistry, { description: "Unique tag key" }),
166
+ name: z.optional(z.string()).register(z.globalRegistry, { description: "Display name for the tag" }),
167
+ description: z.optional(z.string()).register(z.globalRegistry, { description: "Description of the tag" }),
168
+ instructions: z.optional(z.string()).register(z.globalRegistry, { description: "AI instructions to apply when this tag is used" })
169
169
  },
170
170
  annotations: { destructiveHint: false }
171
171
  }, async ({ clientId, clientSecret, key, name, description, instructions }) => {
@@ -186,11 +186,11 @@ const loadAPITools = (server) => {
186
186
  description: "Update an existing tag.",
187
187
  inputSchema: {
188
188
  ...authSchema,
189
- tagId: z.string().describe("Tag ID to update"),
190
- key: z.string().optional().describe("New key"),
191
- name: z.string().optional().describe("New display name"),
192
- description: z.string().optional().describe("New description"),
193
- instructions: z.string().optional().describe("New AI instructions")
189
+ tagId: z.string().register(z.globalRegistry, { description: "Tag ID to update" }),
190
+ key: z.optional(z.string()).register(z.globalRegistry, { description: "New key" }),
191
+ name: z.optional(z.string()).register(z.globalRegistry, { description: "New display name" }),
192
+ description: z.optional(z.string()).register(z.globalRegistry, { description: "New description" }),
193
+ instructions: z.optional(z.string()).register(z.globalRegistry, { description: "New AI instructions" })
194
194
  },
195
195
  annotations: { destructiveHint: true }
196
196
  }, async ({ clientId, clientSecret, tagId, key, name, description, instructions }) => {
@@ -211,7 +211,7 @@ const loadAPITools = (server) => {
211
211
  description: "Delete a tag by its ID.",
212
212
  inputSchema: {
213
213
  ...authSchema,
214
- tagId: z.string().describe("Tag ID to delete")
214
+ tagId: z.string().register(z.globalRegistry, { description: "Tag ID to delete" })
215
215
  },
216
216
  annotations: { destructiveHint: true }
217
217
  }, async ({ clientId, clientSecret, tagId }) => {
@@ -227,8 +227,8 @@ const loadAPITools = (server) => {
227
227
  description: "List all organizations the authenticated user belongs to.",
228
228
  inputSchema: {
229
229
  ...authSchema,
230
- page: z.number().optional().describe("Page number (1-based)"),
231
- pageSize: z.number().optional().describe("Items per page")
230
+ page: z.optional(z.number()).register(z.globalRegistry, { description: "Page number (1-based)" }),
231
+ pageSize: z.optional(z.number()).register(z.globalRegistry, { description: "Items per page" })
232
232
  },
233
233
  annotations: { readOnlyHint: true }
234
234
  }, async ({ clientId, clientSecret, page, pageSize }) => {
@@ -247,7 +247,7 @@ const loadAPITools = (server) => {
247
247
  description: "Select an organization as the current active organization. Required before accessing organization-specific resources.",
248
248
  inputSchema: {
249
249
  ...authSchema,
250
- organizationId: z.string().describe("Organization ID to select")
250
+ organizationId: z.string().register(z.globalRegistry, { description: "Organization ID to select" })
251
251
  },
252
252
  annotations: { destructiveHint: false }
253
253
  }, async ({ clientId, clientSecret, organizationId }) => {
@@ -263,7 +263,7 @@ const loadAPITools = (server) => {
263
263
  description: "Update the selected organization name or settings.",
264
264
  inputSchema: {
265
265
  ...authSchema,
266
- name: z.string().optional().describe("New organization name")
266
+ name: z.optional(z.string()).register(z.globalRegistry, { description: "New organization name" })
267
267
  },
268
268
  annotations: { destructiveHint: true }
269
269
  }, async ({ clientId, clientSecret, name }) => {
@@ -279,8 +279,8 @@ const loadAPITools = (server) => {
279
279
  description: "List all Intlayer CMS projects for the selected organization. These are server-side projects, not local project directories.",
280
280
  inputSchema: {
281
281
  ...authSchema,
282
- page: z.number().optional().describe("Page number (1-based)"),
283
- pageSize: z.number().optional().describe("Items per page")
282
+ page: z.optional(z.number()).register(z.globalRegistry, { description: "Page number (1-based)" }),
283
+ pageSize: z.optional(z.number()).register(z.globalRegistry, { description: "Items per page" })
284
284
  },
285
285
  annotations: { readOnlyHint: true }
286
286
  }, async ({ clientId, clientSecret, page, pageSize }) => {
@@ -299,7 +299,7 @@ const loadAPITools = (server) => {
299
299
  description: "Select a CMS project as the current active project. Required before accessing project-specific dictionaries.",
300
300
  inputSchema: {
301
301
  ...authSchema,
302
- projectId: z.string().describe("Project ID to select")
302
+ projectId: z.string().register(z.globalRegistry, { description: "Project ID to select" })
303
303
  },
304
304
  annotations: { destructiveHint: false }
305
305
  }, async ({ clientId, clientSecret, projectId }) => {
@@ -315,7 +315,7 @@ const loadAPITools = (server) => {
315
315
  description: "Create a new CMS project in the selected organization.",
316
316
  inputSchema: {
317
317
  ...authSchema,
318
- name: z.string().describe("Project name")
318
+ name: z.string().register(z.globalRegistry, { description: "Project name" })
319
319
  },
320
320
  annotations: { destructiveHint: false }
321
321
  }, async ({ clientId, clientSecret, name }) => {
@@ -331,7 +331,7 @@ const loadAPITools = (server) => {
331
331
  description: "Update the selected CMS project settings.",
332
332
  inputSchema: {
333
333
  ...authSchema,
334
- name: z.string().optional().describe("New project name")
334
+ name: z.optional(z.string()).register(z.globalRegistry, { description: "New project name" })
335
335
  },
336
336
  annotations: { destructiveHint: true }
337
337
  }, async ({ clientId, clientSecret, name }) => {
@@ -347,7 +347,7 @@ const loadAPITools = (server) => {
347
347
  description: "Select a CMS environment as the current active environment. Required before accessing environment-specific dictionaries.",
348
348
  inputSchema: {
349
349
  ...authSchema,
350
- environmentId: z.string().describe("Environment ID to select")
350
+ environmentId: z.string().register(z.globalRegistry, { description: "Environment ID to select" })
351
351
  },
352
352
  annotations: { destructiveHint: false }
353
353
  }, async ({ clientId, clientSecret, environmentId }) => {
@@ -376,7 +376,7 @@ const loadAPITools = (server) => {
376
376
  description: "Create a new CMS environment in the selected project.",
377
377
  inputSchema: {
378
378
  ...authSchema,
379
- name: z.string().describe("Environment name")
379
+ name: z.string().register(z.globalRegistry, { description: "Environment name" })
380
380
  },
381
381
  annotations: { destructiveHint: false }
382
382
  }, async ({ clientId, clientSecret, name }) => {
@@ -392,8 +392,8 @@ const loadAPITools = (server) => {
392
392
  description: "Update the selected CMS environment settings.",
393
393
  inputSchema: {
394
394
  ...authSchema,
395
- environmentId: z.string().describe("Environment ID to update"),
396
- name: z.string().optional().describe("New environment name")
395
+ environmentId: z.string().register(z.globalRegistry, { description: "Environment ID to update" }),
396
+ name: z.optional(z.string()).register(z.globalRegistry, { description: "New environment name" })
397
397
  },
398
398
  annotations: { destructiveHint: true }
399
399
  }, async ({ clientId, clientSecret, environmentId, name }) => {
@@ -409,7 +409,7 @@ const loadAPITools = (server) => {
409
409
  description: "Delete a CMS environment by its ID.",
410
410
  inputSchema: {
411
411
  ...authSchema,
412
- environmentId: z.string().describe("Environment ID to delete")
412
+ environmentId: z.string().register(z.globalRegistry, { description: "Environment ID to delete" })
413
413
  },
414
414
  annotations: { destructiveHint: true }
415
415
  }, async ({ clientId, clientSecret, environmentId }) => {
@@ -425,11 +425,11 @@ const loadAPITools = (server) => {
425
425
  description: "Migrate dictionaries and configuration from one environment to another.",
426
426
  inputSchema: {
427
427
  ...authSchema,
428
- sourceEnvironmentId: z.string().describe("Source environment ID"),
429
- targetEnvironmentId: z.string().describe("Target environment ID"),
430
- strategy: z.enum(["overwrite", "fill-missing"]).describe("Migration strategy: overwrite existing or only fill missing"),
431
- migrateContent: z.boolean().optional().describe("Whether to migrate content (dictionaries)"),
432
- migrateConfiguration: z.boolean().optional().describe("Whether to migrate environment configuration")
428
+ sourceEnvironmentId: z.string().register(z.globalRegistry, { description: "Source environment ID" }),
429
+ targetEnvironmentId: z.string().register(z.globalRegistry, { description: "Target environment ID" }),
430
+ strategy: z.enum(["overwrite", "fill-missing"]).register(z.globalRegistry, { description: "Migration strategy: overwrite existing or only fill missing" }),
431
+ migrateContent: z.optional(z.boolean()).register(z.globalRegistry, { description: "Whether to migrate content (dictionaries)" }),
432
+ migrateConfiguration: z.optional(z.boolean()).register(z.globalRegistry, { description: "Whether to migrate environment configuration" })
433
433
  },
434
434
  annotations: { destructiveHint: true }
435
435
  }, async ({ clientId, clientSecret, sourceEnvironmentId, targetEnvironmentId, strategy, migrateContent, migrateConfiguration }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"api.mjs","names":[],"sources":["../../../src/tools/api.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport { editor } from '@intlayer/config/built';\nimport { getEditorClientSecret } from '@intlayer/config/secrets';\nimport type { ContentNode } from '@intlayer/types/dictionary';\nimport z from 'zod';\nimport type { McpServer } from './docs';\n\ntype LoadAPITools = (server: McpServer) => void;\n\nconst authSchema = {\n clientId: z\n .string()\n .optional()\n .describe(\n 'Intlayer OAuth2 client ID (access key). Falls back to INTLAYER_CLIENT_ID env var.'\n ),\n clientSecret: z\n .string()\n .optional()\n .describe(\n 'Intlayer OAuth2 client secret. Falls back to INTLAYER_CLIENT_SECRET env var.'\n ),\n};\n\nconst getAPI = async (clientId?: string, clientSecret?: string) => {\n const resolvedClientId = clientId ?? editor.clientId;\n\n const resolvedClientSecret = clientSecret ?? getEditorClientSecret();\n\n if (!resolvedClientId || !resolvedClientSecret) {\n throw new Error(\n 'Intlayer credentials not found. Provide clientId/clientSecret or set INTLAYER_CLIENT_ID/INTLAYER_CLIENT_SECRET.'\n );\n }\n\n const configWithCreds = {\n editor: {\n ...editor,\n clientId: resolvedClientId,\n clientSecret: resolvedClientSecret,\n },\n };\n\n const tempAPI = getIntlayerAPI({}, configWithCreds);\n const tokenResult = await tempAPI.oAuth.getOAuth2AccessToken();\n const token = (tokenResult as any)?.data?.access_token as string | undefined;\n\n if (!token) {\n throw new Error(\n 'Failed to obtain OAuth2 access token. Check your credentials.'\n );\n }\n\n return getIntlayerAPI(\n { headers: { Authorization: `Bearer ${token}` } },\n { editor }\n );\n};\n\nconst ok = (data: unknown) => ({\n content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],\n});\n\nconst fail = (label: string, error: unknown) => ({\n content: [\n {\n type: 'text' as const,\n text: `${label} failed: ${error instanceof Error ? error.message : String(error)}`,\n },\n ],\n isError: true as const,\n});\n\nexport const loadAPITools: LoadAPITools = (server) => {\n // ── Dictionaries ──────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-dictionaries-list',\n {\n title: 'List Dictionaries',\n description:\n 'List all dictionaries for the selected project. Returns keys, IDs, and metadata.',\n inputSchema: {\n ...authSchema,\n page: z.number().optional().describe('Page number (1-based)'),\n pageSize: z.number().optional().describe('Items per page'),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.getDictionaries({\n page,\n pageSize,\n });\n return ok(result);\n } catch (error) {\n return fail('List dictionaries', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-get',\n {\n title: 'Get Dictionary',\n description: 'Get a dictionary by its key, including its full content.',\n inputSchema: {\n ...authSchema,\n dictionaryKey: z.string().describe('The dictionary key'),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, dictionaryKey }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.getDictionary(dictionaryKey);\n return ok(result);\n } catch (error) {\n return fail('Get dictionary', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-create',\n {\n title: 'Create Dictionary',\n description: 'Create a new dictionary in the selected project.',\n inputSchema: {\n ...authSchema,\n projectId: z\n .string()\n .describe(\n 'ID of the CMS project owning the dictionary. Must be the currently selected project.'\n ),\n key: z.string().describe('Unique key for the dictionary'),\n title: z.string().optional().describe('Human-readable title'),\n description: z\n .string()\n .optional()\n .describe('Description of the dictionary'),\n content: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Initial content as JSON object'),\n },\n annotations: { destructiveHint: false },\n },\n async ({\n clientId,\n clientSecret,\n projectId,\n key,\n title,\n description,\n content,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.addDictionary({\n dictionary: {\n key,\n title,\n description,\n content: content as ContentNode | undefined,\n projectIds: [projectId],\n },\n });\n return ok(result);\n } catch (error) {\n return fail('Create dictionary', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-update',\n {\n title: 'Update Dictionary',\n description: 'Update an existing dictionary content or metadata.',\n inputSchema: {\n ...authSchema,\n id: z.string().describe('Dictionary ID'),\n key: z.string().optional().describe('New key for the dictionary'),\n title: z.string().optional().describe('New title'),\n description: z.string().optional().describe('New description'),\n content: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Updated content as JSON object'),\n },\n annotations: { destructiveHint: true },\n },\n async ({\n clientId,\n clientSecret,\n id,\n key,\n title,\n description,\n content,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.updateDictionary({\n id,\n key,\n title,\n description,\n content,\n });\n return ok(result);\n } catch (error) {\n return fail('Update dictionary', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-delete',\n {\n title: 'Delete Dictionary',\n description:\n 'Delete a dictionary by its ID. This action is irreversible.',\n inputSchema: {\n ...authSchema,\n dictionaryId: z.string().describe('Dictionary ID to delete'),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, dictionaryId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.deleteDictionary(dictionaryId);\n return ok(result);\n } catch (error) {\n return fail('Delete dictionary', error);\n }\n }\n );\n\n // ── Tags ──────────────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-tags-list',\n {\n title: 'List Tags',\n description: 'List all tags for the selected organization.',\n inputSchema: {\n ...authSchema,\n page: z.number().optional().describe('Page number (1-based)'),\n pageSize: z.number().optional().describe('Items per page'),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.getTags({ page, pageSize });\n return ok(result);\n } catch (error) {\n return fail('List tags', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-tag-create',\n {\n title: 'Create Tag',\n description:\n 'Create a new tag in the organization. Tags can be used to group dictionaries and provide AI context.',\n inputSchema: {\n ...authSchema,\n key: z.string().describe('Unique tag key'),\n name: z.string().optional().describe('Display name for the tag'),\n description: z.string().optional().describe('Description of the tag'),\n instructions: z\n .string()\n .optional()\n .describe('AI instructions to apply when this tag is used'),\n },\n annotations: { destructiveHint: false },\n },\n async ({\n clientId,\n clientSecret,\n key,\n name,\n description,\n instructions,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.addTag({\n key,\n name,\n description,\n instructions,\n });\n return ok(result);\n } catch (error) {\n return fail('Create tag', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-tag-update',\n {\n title: 'Update Tag',\n description: 'Update an existing tag.',\n inputSchema: {\n ...authSchema,\n tagId: z.string().describe('Tag ID to update'),\n key: z.string().optional().describe('New key'),\n name: z.string().optional().describe('New display name'),\n description: z.string().optional().describe('New description'),\n instructions: z.string().optional().describe('New AI instructions'),\n },\n annotations: { destructiveHint: true },\n },\n async ({\n clientId,\n clientSecret,\n tagId,\n key,\n name,\n description,\n instructions,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.updateTag(tagId, {\n key,\n name,\n description,\n instructions,\n });\n return ok(result);\n } catch (error) {\n return fail('Update tag', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-tag-delete',\n {\n title: 'Delete Tag',\n description: 'Delete a tag by its ID.',\n inputSchema: {\n ...authSchema,\n tagId: z.string().describe('Tag ID to delete'),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, tagId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.deleteTag(tagId);\n return ok(result);\n } catch (error) {\n return fail('Delete tag', error);\n }\n }\n );\n\n // ── Organizations ─────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-organizations-list',\n {\n title: 'List Organizations',\n description: 'List all organizations the authenticated user belongs to.',\n inputSchema: {\n ...authSchema,\n page: z.number().optional().describe('Page number (1-based)'),\n pageSize: z.number().optional().describe('Items per page'),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.organization.getOrganizations({\n page,\n pageSize,\n });\n return ok(result);\n } catch (error) {\n return fail('List organizations', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-organization-select',\n {\n title: 'Select Organization',\n description:\n 'Select an organization as the current active organization. Required before accessing organization-specific resources.',\n inputSchema: {\n ...authSchema,\n organizationId: z.string().describe('Organization ID to select'),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, organizationId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result =\n await api.organization.selectOrganization(organizationId);\n return ok(result);\n } catch (error) {\n return fail('Select organization', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-organization-update',\n {\n title: 'Update Organization',\n description: 'Update the selected organization name or settings.',\n inputSchema: {\n ...authSchema,\n name: z.string().optional().describe('New organization name'),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, name }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.organization.updateOrganization({\n name,\n });\n return ok(result);\n } catch (error) {\n return fail('Update organization', error);\n }\n }\n );\n\n // ── Projects ──────────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-cms-projects-list',\n {\n title: 'List CMS Projects',\n description:\n 'List all Intlayer CMS projects for the selected organization. These are server-side projects, not local project directories.',\n inputSchema: {\n ...authSchema,\n page: z.number().optional().describe('Page number (1-based)'),\n pageSize: z.number().optional().describe('Items per page'),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.getProjects({ page, pageSize });\n return ok(result);\n } catch (error) {\n return fail('List CMS projects', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-project-select',\n {\n title: 'Select CMS Project',\n description:\n 'Select a CMS project as the current active project. Required before accessing project-specific dictionaries.',\n inputSchema: {\n ...authSchema,\n projectId: z.string().describe('Project ID to select'),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, projectId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.selectProject(projectId);\n return ok(result);\n } catch (error) {\n return fail('Select CMS project', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-project-create',\n {\n title: 'Create CMS Project',\n description: 'Create a new CMS project in the selected organization.',\n inputSchema: {\n ...authSchema,\n name: z.string().describe('Project name'),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, name }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.addProject({ name });\n return ok(result);\n } catch (error) {\n return fail('Create CMS project', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-project-update',\n {\n title: 'Update CMS Project',\n description: 'Update the selected CMS project settings.',\n inputSchema: {\n ...authSchema,\n name: z.string().optional().describe('New project name'),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, name }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.updateProject({ name });\n return ok(result);\n } catch (error) {\n return fail('Update CMS project', error);\n }\n }\n );\n\n // ── Environments ──────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-cms-environment-select',\n {\n title: 'Select CMS Environment',\n description:\n 'Select a CMS environment as the current active environment. Required before accessing environment-specific dictionaries.',\n inputSchema: {\n ...authSchema,\n environmentId: z.string().describe('Environment ID to select'),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, environmentId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.environment.selectEnvironment(environmentId);\n return ok(result);\n } catch (error) {\n return fail('Select CMS environment', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-environment-reset',\n {\n title: 'Reset CMS Environment to Production',\n description:\n 'Reset the current active environment to the default production environment.',\n inputSchema: {\n ...authSchema,\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.environment.resetToProductionEnvironment();\n return ok(result);\n } catch (error) {\n return fail('Reset CMS environment', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-environment-create',\n {\n title: 'Create CMS Environment',\n description: 'Create a new CMS environment in the selected project.',\n inputSchema: {\n ...authSchema,\n name: z.string().describe('Environment name'),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, name }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.environment.addEnvironment({ name });\n return ok(result);\n } catch (error) {\n return fail('Create CMS environment', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-environment-update',\n {\n title: 'Update CMS Environment',\n description: 'Update the selected CMS environment settings.',\n inputSchema: {\n ...authSchema,\n environmentId: z.string().describe('Environment ID to update'),\n name: z.string().optional().describe('New environment name'),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, environmentId, name }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.environment.updateEnvironment(environmentId, {\n name,\n });\n return ok(result);\n } catch (error) {\n return fail('Update CMS environment', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-environment-delete',\n {\n title: 'Delete CMS Environment',\n description: 'Delete a CMS environment by its ID.',\n inputSchema: {\n ...authSchema,\n environmentId: z.string().describe('Environment ID to delete'),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, environmentId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.environment.deleteEnvironment(environmentId);\n return ok(result);\n } catch (error) {\n return fail('Delete CMS environment', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-environment-migrate',\n {\n title: 'Migrate CMS Environment',\n description:\n 'Migrate dictionaries and configuration from one environment to another.',\n inputSchema: {\n ...authSchema,\n sourceEnvironmentId: z.string().describe('Source environment ID'),\n targetEnvironmentId: z.string().describe('Target environment ID'),\n strategy: z\n .enum(['overwrite', 'fill-missing'])\n .describe(\n 'Migration strategy: overwrite existing or only fill missing'\n ),\n migrateContent: z\n .boolean()\n .optional()\n .describe('Whether to migrate content (dictionaries)'),\n migrateConfiguration: z\n .boolean()\n .optional()\n .describe('Whether to migrate environment configuration'),\n },\n annotations: { destructiveHint: true },\n },\n async ({\n clientId,\n clientSecret,\n sourceEnvironmentId,\n targetEnvironmentId,\n strategy,\n migrateContent,\n migrateConfiguration,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.environment.migrateEnvironment({\n sourceEnvironmentId,\n targetEnvironmentId,\n strategy,\n migrateContent,\n migrateConfiguration,\n });\n return ok(result);\n } catch (error) {\n return fail('Migrate CMS environment', error);\n }\n }\n );\n};\n"],"mappings":";;;;;;AASA,MAAM,aAAa;CACjB,UAAU,EACP,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SACC,mFACF;CACF,cAAc,EACX,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SACC,8EACF;AACJ;AAEA,MAAM,SAAS,OAAO,UAAmB,iBAA0B;CACjE,MAAM,mBAAmB,YAAY,OAAO;CAE5C,MAAM,uBAAuB,gBAAgB,sBAAsB;CAEnE,IAAI,CAAC,oBAAoB,CAAC,sBACxB,MAAM,IAAI,MACR,iHACF;CAGF,MAAM,kBAAkB,EACtB,QAAQ;EACN,GAAG;EACH,UAAU;EACV,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CAEA,OAAO,aACL,mCACA;EACE,OAAO;EACP,aAAa;EACb,aAAa;GACX,GAAG;GACH,eAAe,EAAE,OAAO,CAAC,CAAC,SAAS,0BAA0B;EAC/D;EACA,aAAa,EAAE,iBAAiB,KAAK;CACvC,GACA,OAAO,EAAE,UAAU,cAAc,oBAAoB;EACnD,IAAI;GAEF,MAAM,SAAS,OAAM,MADH,OAAO,UAAU,YAAY,EACvB,CAAC,YAAY,kBAAkB,aAAa;GACpE,OAAO,GAAG,MAAM;EAClB,SAAS,OAAO;GACd,OAAO,KAAK,0BAA0B,KAAK;EAC7C;CACF,CACF;CAEA,OAAO,aACL,oCACA;EACE,OAAO;EACP,aACE;EACF,aAAa;GACX,GAAG;GACH,qBAAqB,EAAE,OAAO,CAAC,CAAC,SAAS,uBAAuB;GAChE,qBAAqB,EAAE,OAAO,CAAC,CAAC,SAAS,uBAAuB;GAChE,UAAU,EACP,KAAK,CAAC,aAAa,cAAc,CAAC,CAAC,CACnC,SACC,6DACF;GACF,gBAAgB,EACb,QAAQ,CAAC,CACT,SAAS,CAAC,CACV,SAAS,2CAA2C;GACvD,sBAAsB,EACnB,QAAQ,CAAC,CACT,SAAS,CAAC,CACV,SAAS,8CAA8C;EAC5D;EACA,aAAa,EAAE,iBAAiB,KAAK;CACvC,GACA,OAAO,EACL,UACA,cACA,qBACA,qBACA,UACA,gBACA,2BACI;EACJ,IAAI;GAEF,MAAM,SAAS,OAAM,MADH,OAAO,UAAU,YAAY,EACvB,CAAC,YAAY,mBAAmB;IACtD;IACA;IACA;IACA;IACA;GACF,CAAC;GACD,OAAO,GAAG,MAAM;EAClB,SAAS,OAAO;GACd,OAAO,KAAK,2BAA2B,KAAK;EAC9C;CACF,CACF;AACF"}
1
+ {"version":3,"file":"api.mjs","names":[],"sources":["../../../src/tools/api.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport { editor } from '@intlayer/config/built';\nimport { getEditorClientSecret } from '@intlayer/config/secrets';\nimport type { ContentNode } from '@intlayer/types/dictionary';\nimport { z } from 'zod/mini';\nimport type { McpServer } from './docs';\n\ntype LoadAPITools = (server: McpServer) => void;\n\nconst authSchema = {\n clientId: z.optional(z.string()).register(z.globalRegistry, {\n description:\n 'Intlayer OAuth2 client ID (access key). Falls back to INTLAYER_CLIENT_ID env var.',\n }),\n clientSecret: z.optional(z.string()).register(z.globalRegistry, {\n description:\n 'Intlayer OAuth2 client secret. Falls back to INTLAYER_CLIENT_SECRET env var.',\n }),\n};\n\nconst getAPI = async (clientId?: string, clientSecret?: string) => {\n const resolvedClientId = clientId ?? editor.clientId;\n\n const resolvedClientSecret = clientSecret ?? getEditorClientSecret();\n\n if (!resolvedClientId || !resolvedClientSecret) {\n throw new Error(\n 'Intlayer credentials not found. Provide clientId/clientSecret or set INTLAYER_CLIENT_ID/INTLAYER_CLIENT_SECRET.'\n );\n }\n\n const configWithCreds = {\n editor: {\n ...editor,\n clientId: resolvedClientId,\n clientSecret: resolvedClientSecret,\n },\n };\n\n const tempAPI = getIntlayerAPI({}, configWithCreds);\n const tokenResult = await tempAPI.oAuth.getOAuth2AccessToken();\n const token = (tokenResult as any)?.data?.access_token as string | undefined;\n\n if (!token) {\n throw new Error(\n 'Failed to obtain OAuth2 access token. Check your credentials.'\n );\n }\n\n return getIntlayerAPI(\n { headers: { Authorization: `Bearer ${token}` } },\n { editor }\n );\n};\n\nconst ok = (data: unknown) => ({\n content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],\n});\n\nconst fail = (label: string, error: unknown) => ({\n content: [\n {\n type: 'text' as const,\n text: `${label} failed: ${error instanceof Error ? error.message : String(error)}`,\n },\n ],\n isError: true as const,\n});\n\nexport const loadAPITools: LoadAPITools = (server) => {\n // ── Dictionaries ──────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-dictionaries-list',\n {\n title: 'List Dictionaries',\n description:\n 'List all dictionaries for the selected project. Returns keys, IDs, and metadata.',\n inputSchema: {\n ...authSchema,\n page: z\n .optional(z.number())\n .register(z.globalRegistry, { description: 'Page number (1-based)' }),\n pageSize: z\n .optional(z.number())\n .register(z.globalRegistry, { description: 'Items per page' }),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.getDictionaries({\n page,\n pageSize,\n });\n return ok(result);\n } catch (error) {\n return fail('List dictionaries', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-get',\n {\n title: 'Get Dictionary',\n description: 'Get a dictionary by its key, including its full content.',\n inputSchema: {\n ...authSchema,\n dictionaryKey: z\n .string()\n .register(z.globalRegistry, { description: 'The dictionary key' }),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, dictionaryKey }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.getDictionary(dictionaryKey);\n return ok(result);\n } catch (error) {\n return fail('Get dictionary', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-create',\n {\n title: 'Create Dictionary',\n description: 'Create a new dictionary in the selected project.',\n inputSchema: {\n ...authSchema,\n projectId: z.string().register(z.globalRegistry, {\n description:\n 'ID of the CMS project owning the dictionary. Must be the currently selected project.',\n }),\n key: z.string().register(z.globalRegistry, {\n description: 'Unique key for the dictionary',\n }),\n title: z\n .optional(z.string())\n .register(z.globalRegistry, { description: 'Human-readable title' }),\n description: z.optional(z.string()).register(z.globalRegistry, {\n description: 'Description of the dictionary',\n }),\n content: z\n .optional(z.record(z.string(), z.unknown()))\n .register(z.globalRegistry, {\n description: 'Initial content as JSON object',\n }),\n },\n annotations: { destructiveHint: false },\n },\n async ({\n clientId,\n clientSecret,\n projectId,\n key,\n title,\n description,\n content,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.addDictionary({\n dictionary: {\n key,\n title,\n description,\n content: content as ContentNode | undefined,\n projectIds: [projectId],\n },\n });\n return ok(result);\n } catch (error) {\n return fail('Create dictionary', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-update',\n {\n title: 'Update Dictionary',\n description: 'Update an existing dictionary content or metadata.',\n inputSchema: {\n ...authSchema,\n id: z\n .string()\n .register(z.globalRegistry, { description: 'Dictionary ID' }),\n key: z.optional(z.string()).register(z.globalRegistry, {\n description: 'New key for the dictionary',\n }),\n title: z\n .optional(z.string())\n .register(z.globalRegistry, { description: 'New title' }),\n description: z\n .optional(z.string())\n .register(z.globalRegistry, { description: 'New description' }),\n content: z\n .optional(z.record(z.string(), z.unknown()))\n .register(z.globalRegistry, {\n description: 'Updated content as JSON object',\n }),\n },\n annotations: { destructiveHint: true },\n },\n async ({\n clientId,\n clientSecret,\n id,\n key,\n title,\n description,\n content,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.updateDictionary({\n id,\n key,\n title,\n description,\n content,\n });\n return ok(result);\n } catch (error) {\n return fail('Update dictionary', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-delete',\n {\n title: 'Delete Dictionary',\n description:\n 'Delete a dictionary by its ID. This action is irreversible.',\n inputSchema: {\n ...authSchema,\n dictionaryId: z.string().register(z.globalRegistry, {\n description: 'Dictionary ID to delete',\n }),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, dictionaryId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.deleteDictionary(dictionaryId);\n return ok(result);\n } catch (error) {\n return fail('Delete dictionary', error);\n }\n }\n );\n\n // ── Tags ──────────────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-tags-list',\n {\n title: 'List Tags',\n description: 'List all tags for the selected organization.',\n inputSchema: {\n ...authSchema,\n page: z\n .optional(z.number())\n .register(z.globalRegistry, { description: 'Page number (1-based)' }),\n pageSize: z\n .optional(z.number())\n .register(z.globalRegistry, { description: 'Items per page' }),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.getTags({ page, pageSize });\n return ok(result);\n } catch (error) {\n return fail('List tags', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-tag-create',\n {\n title: 'Create Tag',\n description:\n 'Create a new tag in the organization. Tags can be used to group dictionaries and provide AI context.',\n inputSchema: {\n ...authSchema,\n key: z\n .string()\n .register(z.globalRegistry, { description: 'Unique tag key' }),\n name: z.optional(z.string()).register(z.globalRegistry, {\n description: 'Display name for the tag',\n }),\n description: z.optional(z.string()).register(z.globalRegistry, {\n description: 'Description of the tag',\n }),\n instructions: z.optional(z.string()).register(z.globalRegistry, {\n description: 'AI instructions to apply when this tag is used',\n }),\n },\n annotations: { destructiveHint: false },\n },\n async ({\n clientId,\n clientSecret,\n key,\n name,\n description,\n instructions,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.addTag({\n key,\n name,\n description,\n instructions,\n });\n return ok(result);\n } catch (error) {\n return fail('Create tag', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-tag-update',\n {\n title: 'Update Tag',\n description: 'Update an existing tag.',\n inputSchema: {\n ...authSchema,\n tagId: z\n .string()\n .register(z.globalRegistry, { description: 'Tag ID to update' }),\n key: z\n .optional(z.string())\n .register(z.globalRegistry, { description: 'New key' }),\n name: z\n .optional(z.string())\n .register(z.globalRegistry, { description: 'New display name' }),\n description: z\n .optional(z.string())\n .register(z.globalRegistry, { description: 'New description' }),\n instructions: z\n .optional(z.string())\n .register(z.globalRegistry, { description: 'New AI instructions' }),\n },\n annotations: { destructiveHint: true },\n },\n async ({\n clientId,\n clientSecret,\n tagId,\n key,\n name,\n description,\n instructions,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.updateTag(tagId, {\n key,\n name,\n description,\n instructions,\n });\n return ok(result);\n } catch (error) {\n return fail('Update tag', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-tag-delete',\n {\n title: 'Delete Tag',\n description: 'Delete a tag by its ID.',\n inputSchema: {\n ...authSchema,\n tagId: z\n .string()\n .register(z.globalRegistry, { description: 'Tag ID to delete' }),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, tagId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.deleteTag(tagId);\n return ok(result);\n } catch (error) {\n return fail('Delete tag', error);\n }\n }\n );\n\n // ── Organizations ─────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-organizations-list',\n {\n title: 'List Organizations',\n description: 'List all organizations the authenticated user belongs to.',\n inputSchema: {\n ...authSchema,\n page: z\n .optional(z.number())\n .register(z.globalRegistry, { description: 'Page number (1-based)' }),\n pageSize: z\n .optional(z.number())\n .register(z.globalRegistry, { description: 'Items per page' }),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.organization.getOrganizations({\n page,\n pageSize,\n });\n return ok(result);\n } catch (error) {\n return fail('List organizations', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-organization-select',\n {\n title: 'Select Organization',\n description:\n 'Select an organization as the current active organization. Required before accessing organization-specific resources.',\n inputSchema: {\n ...authSchema,\n organizationId: z.string().register(z.globalRegistry, {\n description: 'Organization ID to select',\n }),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, organizationId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result =\n await api.organization.selectOrganization(organizationId);\n return ok(result);\n } catch (error) {\n return fail('Select organization', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-organization-update',\n {\n title: 'Update Organization',\n description: 'Update the selected organization name or settings.',\n inputSchema: {\n ...authSchema,\n name: z\n .optional(z.string())\n .register(z.globalRegistry, { description: 'New organization name' }),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, name }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.organization.updateOrganization({\n name,\n });\n return ok(result);\n } catch (error) {\n return fail('Update organization', error);\n }\n }\n );\n\n // ── Projects ──────────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-cms-projects-list',\n {\n title: 'List CMS Projects',\n description:\n 'List all Intlayer CMS projects for the selected organization. These are server-side projects, not local project directories.',\n inputSchema: {\n ...authSchema,\n page: z\n .optional(z.number())\n .register(z.globalRegistry, { description: 'Page number (1-based)' }),\n pageSize: z\n .optional(z.number())\n .register(z.globalRegistry, { description: 'Items per page' }),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.getProjects({ page, pageSize });\n return ok(result);\n } catch (error) {\n return fail('List CMS projects', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-project-select',\n {\n title: 'Select CMS Project',\n description:\n 'Select a CMS project as the current active project. Required before accessing project-specific dictionaries.',\n inputSchema: {\n ...authSchema,\n projectId: z\n .string()\n .register(z.globalRegistry, { description: 'Project ID to select' }),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, projectId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.selectProject(projectId);\n return ok(result);\n } catch (error) {\n return fail('Select CMS project', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-project-create',\n {\n title: 'Create CMS Project',\n description: 'Create a new CMS project in the selected organization.',\n inputSchema: {\n ...authSchema,\n name: z\n .string()\n .register(z.globalRegistry, { description: 'Project name' }),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, name }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.addProject({ name });\n return ok(result);\n } catch (error) {\n return fail('Create CMS project', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-project-update',\n {\n title: 'Update CMS Project',\n description: 'Update the selected CMS project settings.',\n inputSchema: {\n ...authSchema,\n name: z\n .optional(z.string())\n .register(z.globalRegistry, { description: 'New project name' }),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, name }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.updateProject({ name });\n return ok(result);\n } catch (error) {\n return fail('Update CMS project', error);\n }\n }\n );\n\n // ── Environments ──────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-cms-environment-select',\n {\n title: 'Select CMS Environment',\n description:\n 'Select a CMS environment as the current active environment. Required before accessing environment-specific dictionaries.',\n inputSchema: {\n ...authSchema,\n environmentId: z.string().register(z.globalRegistry, {\n description: 'Environment ID to select',\n }),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, environmentId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.environment.selectEnvironment(environmentId);\n return ok(result);\n } catch (error) {\n return fail('Select CMS environment', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-environment-reset',\n {\n title: 'Reset CMS Environment to Production',\n description:\n 'Reset the current active environment to the default production environment.',\n inputSchema: {\n ...authSchema,\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.environment.resetToProductionEnvironment();\n return ok(result);\n } catch (error) {\n return fail('Reset CMS environment', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-environment-create',\n {\n title: 'Create CMS Environment',\n description: 'Create a new CMS environment in the selected project.',\n inputSchema: {\n ...authSchema,\n name: z\n .string()\n .register(z.globalRegistry, { description: 'Environment name' }),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, name }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.environment.addEnvironment({ name });\n return ok(result);\n } catch (error) {\n return fail('Create CMS environment', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-environment-update',\n {\n title: 'Update CMS Environment',\n description: 'Update the selected CMS environment settings.',\n inputSchema: {\n ...authSchema,\n environmentId: z.string().register(z.globalRegistry, {\n description: 'Environment ID to update',\n }),\n name: z\n .optional(z.string())\n .register(z.globalRegistry, { description: 'New environment name' }),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, environmentId, name }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.environment.updateEnvironment(environmentId, {\n name,\n });\n return ok(result);\n } catch (error) {\n return fail('Update CMS environment', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-environment-delete',\n {\n title: 'Delete CMS Environment',\n description: 'Delete a CMS environment by its ID.',\n inputSchema: {\n ...authSchema,\n environmentId: z.string().register(z.globalRegistry, {\n description: 'Environment ID to delete',\n }),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, environmentId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.environment.deleteEnvironment(environmentId);\n return ok(result);\n } catch (error) {\n return fail('Delete CMS environment', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-environment-migrate',\n {\n title: 'Migrate CMS Environment',\n description:\n 'Migrate dictionaries and configuration from one environment to another.',\n inputSchema: {\n ...authSchema,\n sourceEnvironmentId: z\n .string()\n .register(z.globalRegistry, { description: 'Source environment ID' }),\n targetEnvironmentId: z\n .string()\n .register(z.globalRegistry, { description: 'Target environment ID' }),\n strategy: z\n .enum(['overwrite', 'fill-missing'])\n .register(z.globalRegistry, {\n description:\n 'Migration strategy: overwrite existing or only fill missing',\n }),\n migrateContent: z.optional(z.boolean()).register(z.globalRegistry, {\n description: 'Whether to migrate content (dictionaries)',\n }),\n migrateConfiguration: z\n .optional(z.boolean())\n .register(z.globalRegistry, {\n description: 'Whether to migrate environment configuration',\n }),\n },\n annotations: { destructiveHint: true },\n },\n async ({\n clientId,\n clientSecret,\n sourceEnvironmentId,\n targetEnvironmentId,\n strategy,\n migrateContent,\n migrateConfiguration,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.environment.migrateEnvironment({\n sourceEnvironmentId,\n targetEnvironmentId,\n strategy,\n migrateContent,\n migrateConfiguration,\n });\n return ok(result);\n } catch (error) {\n return fail('Migrate CMS environment', error);\n }\n }\n );\n};\n"],"mappings":";;;;;;AASA,MAAM,aAAa;CACjB,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,gBAAgB,EAC1D,aACE,oFACJ,CAAC;CACD,cAAc,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,gBAAgB,EAC9D,aACE,+EACJ,CAAC;AACH;AAEA,MAAM,SAAS,OAAO,UAAmB,iBAA0B;CACjE,MAAM,mBAAmB,YAAY,OAAO;CAE5C,MAAM,uBAAuB,gBAAgB,sBAAsB;CAEnE,IAAI,CAAC,oBAAoB,CAAC,sBACxB,MAAM,IAAI,MACR,iHACF;CAGF,MAAM,kBAAkB,EACtB,QAAQ;EACN,GAAG;EACH,UAAU;EACV,cAAc;CAChB,EACF;CAIA,MAAM,SAAS,MAFC,eAAe,CAAC,GAAG,eACH,CAAC,CAAC,MAAM,qBAAqB,EACnC,EAAU,MAAM;CAE1C,IAAI,CAAC,OACH,MAAM,IAAI,MACR,+DACF;CAGF,OAAO,eACL,EAAE,SAAS,EAAE,eAAe,UAAU,QAAQ,EAAE,GAChD,EAAE,OAAO,CACX;AACF;AAEA,MAAM,MAAM,UAAmB,EAC7B,SAAS,CAAC;CAAE,MAAM;CAAiB,MAAM,KAAK,UAAU,MAAM,MAAM,CAAC;AAAE,CAAC,EAC1E;AAEA,MAAM,QAAQ,OAAe,WAAoB;CAC/C,SAAS,CACP;EACE,MAAM;EACN,MAAM,GAAG,MAAM,WAAW,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACjF,CACF;CACA,SAAS;AACX;AAEA,MAAa,gBAA8B,WAAW;CAGpD,OAAO,aACL,8BACA;EACE,OAAO;EACP,aACE;EACF,aAAa;GACX,GAAG;GACH,MAAM,EACH,SAAS,EAAE,OAAO,CAAC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