Files
agenticSystem/mcp-server/acai-file-tools.json
2026-04-01 23:16:45 +01:00

196 lines
10 KiB
JSON

{
"acai-search-files": {
"description": "Search for text patterns across project files using regex.\n\nSearches through module templates, hooks, sections, styles, and other project files.\nCalls: GET /api/files/search (PENDIENTE: endpoint por crear en el servidor Python).\n\nParameters:\n- query: Regex pattern to find (e.g., \"getVar\\\\(\" to find template variables)\n- include_pattern: Glob filter for files to include (e.g., \"cms/modules/**/*.tpl\")\n- exclude_pattern: Glob filter for files to exclude (e.g., \"**/node_modules/**\")\n- case_sensitive: Whether to match case (default: false)\n\nUseful for finding variable usage across templates, hook references, CSS class usage, etc.",
"parameters": {
"properties": {
"query": {
"example": "getVar\\(",
"type": "string"
},
"include_pattern": {
"example": "cms/modules/**/*.tpl",
"type": "string"
},
"exclude_pattern": {
"example": "**/node_modules/**",
"type": "string"
},
"case_sensitive": {
"example": "false",
"type": "boolean"
}
},
"required": ["query", "include_pattern"],
"type": "object"
}
},
"acai-write": {
"description": "Write content to a project file. Overwrites the existing file if it exists, or creates a new one.\nCalls: POST /api/files/write on the Python server.\n\nThe file path must be relative to the project root (e.g., cms/modules/mi_modulo/index-base.tpl).\n\nIMPORTANT: Prefer acai-line-replace for editing existing files. Use acai-write mainly for:\n- Creating new files (new modules, hooks, styles)\n- Complete file rewrites when most content changes\n\nWhen writing, use \"// ... keep existing code\" comments to preserve unchanged sections:\n- Any unchanged block over 5 lines MUST use this comment\n- The comment MUST contain the exact string \"... keep existing code\"\n- Example: \"// ... keep existing code (hook logic)\"\n\nIf creating multiple files (e.g., a new module with .tpl + .css + .js + hook.php), create all files in parallel.",
"parameters": {
"properties": {
"file_path": {
"example": "cms/modules/hero_banner/index-base.tpl",
"type": "string"
},
"content": {
"example": "<div class=\"hero-banner\">\n <h1>{{getVar('titulo')}}</h1>\n</div>",
"type": "string"
}
},
"required": ["file_path", "content"],
"type": "object"
}
},
"acai-line-replace": {
"description": "Line-based search and replace for editing existing project files.\nThis is the PREFERRED tool for modifying existing code — always use this instead of rewriting entire files with acai-write.\n\nLogic: Reads the file via GET /api/files/read, validates the search content at the specified line range, replaces it, and writes back via POST /api/files/write.\n\nProvide:\n1. file_path — Relative path from project root (e.g., cms/modules/hero/style.css)\n2. search — Content to find (use ... ellipsis for large sections)\n3. first_replaced_line — First line number (1-indexed)\n4. last_replaced_line — Last line number (1-indexed)\n5. replace — New content to replace with\n\nELLIPSIS USAGE (for sections > 6 lines):\n- Include first 2-3 lines of the section\n- Add \"...\" on its own line\n- Include last 2-3 lines\n- Focus on unique context for accurate matching\n\nWhen making multiple edits to the same file in parallel, always use the ORIGINAL line numbers from when you first read the file.\n\nAfter editing an index-base.tpl, you MUST call compile_module to sync changes with the CMS.",
"parameters": {
"properties": {
"file_path": {
"example": "cms/modules/hero_banner/index-base.tpl",
"type": "string"
},
"search": {
"example": "<div class=\"hero-banner\">\n <h1>{{getVar('titulo')}}</h1>\n...\n</div>",
"type": "string"
},
"first_replaced_line": {
"description": "First line number to replace (1-indexed)",
"example": "5",
"type": "number"
},
"last_replaced_line": {
"description": "Last line number to replace (1-indexed)",
"example": "12",
"type": "number"
},
"replace": {
"description": "New content to replace with (without line numbers)",
"example": "<section class=\"hero-banner hero-banner--fullwidth\">\n <h1>{{getVar('titulo')}}</h1>\n <p>{{getVar('subtitulo')}}</p>\n</section>",
"type": "string"
}
},
"required": ["file_path", "search", "first_replaced_line", "last_replaced_line", "replace"],
"type": "object"
}
},
"acai-view": {
"description": "Read the contents of a project file.\nCalls: GET /api/files/read on the Python server.\n\nThe file path must be relative to the project root. You can optionally specify line ranges for large files.\n\nGuidelines:\n- Do NOT use this if the file contents were already provided in context\n- By default reads the first 500 lines. Only use line ranges for large files\n- To read multiple files, invoke this tool multiple times in parallel\n\nCommon files to read:\n- cms/modules/{name}/index-base.tpl — Module HTML template\n- cms/modules/{name}/style.css — Module styles\n- cms/modules/{name}/script.js — Module JavaScript\n- cms/modules/{name}/hook.php — Module PHP hook\n- cms/hooks/{name}.php — Global hooks\n- cms/sections/custom-{name}/index-base.tpl — Custom sections",
"parameters": {
"properties": {
"file_path": {
"example": "cms/modules/hero_banner/index-base.tpl",
"type": "string"
},
"lines": {
"example": "1-100",
"type": "string"
}
},
"required": ["file_path"],
"type": "object"
}
},
"acai-delete": {
"description": "Delete a file from the project.\nCalls: POST /api/files/delete on the Python server.\n\nThe file path must be relative to the project root.\nUse with caution — this action is irreversible. Prefer acai-rename if you want to preserve the file.",
"parameters": {
"properties": {
"file_path": {
"example": "cms/modules/old_module/script.js",
"type": "string"
}
},
"required": ["file_path"],
"type": "object"
}
},
"acai-rename": {
"description": "Rename or move a file within the project.\nCalls: POST /api/files/rename (PENDIENTE: endpoint por crear en el servidor Python).\n\nUse this tool instead of creating a new file and deleting the old one.\nBoth paths must be relative to the project root.",
"parameters": {
"properties": {
"original_file_path": {
"example": "cms/modules/banner/style.css",
"type": "string"
},
"new_file_path": {
"example": "cms/modules/hero_banner/style.css",
"type": "string"
}
},
"required": ["original_file_path", "new_file_path"],
"type": "object"
}
},
"acai-copy": {
"description": "Copy a file or directory to a new location within the project.\nCalls: POST /api/files/copy (PENDIENTE: endpoint por crear en el servidor Python).\n\nUseful for duplicating modules or creating variations of existing templates.\nBoth paths must be relative to the project root.",
"parameters": {
"properties": {
"source_file_path": {
"example": "cms/modules/hero_banner/index-base.tpl",
"type": "string"
},
"destination_file_path": {
"example": "cms/modules/hero_banner_v2/index-base.tpl",
"type": "string"
}
},
"required": ["source_file_path", "destination_file_path"],
"type": "object"
}
},
"acai-read-php-logs": {
"description": "Read PHP and server logs from the project's Docker container.\nCalls: GET /api/logs/{container} on the Python server.\n\nReturns the last 200 lines of the container's log output. You can optionally provide a search query to filter relevant entries.\n\nIMPORTANT:\n- Logs are a snapshot from when the request was made — they do NOT update in real time\n- Do NOT call this more than once per task, as you will get the same results\n- Useful for debugging PHP errors in hooks, module rendering issues, or CMS API failures\n- Cannot verify fixes by re-reading logs — the snapshot won't change",
"parameters": {
"properties": {
"search": {
"description": "Optional text to filter log entries (e.g., 'Fatal error', 'Warning', module name)",
"example": "Fatal error",
"type": "string"
}
},
"required": [],
"type": "object"
}
},
"acai-fetch-website": {
"description": "Fetch a website URL and return its content as markdown, HTML, or screenshot.\nUseful for referencing external designs, documentation, or inspecting the live version of the project.\n\nReturns the content in the requested formats. Use markdown for text extraction, HTML for structure analysis, screenshot for visual reference.",
"parameters": {
"properties": {
"url": {
"example": "https://example.com",
"type": "string"
},
"formats": {
"description": "Comma-separated formats: 'markdown', 'html', 'screenshot'. Defaults to 'markdown'.",
"example": "markdown,screenshot",
"type": "string"
}
},
"required": ["url"],
"type": "object"
}
},
"acai-web-search": {
"description": "Search the web for information relevant to the development task.\n\nUse when you need:\n- Documentation for CSS properties, PHP functions, Twig syntax\n- Design inspiration or reference implementations\n- Troubleshooting specific errors or compatibility issues\n- Information about external APIs or services\n\nSearch tips:\n- Use site:domain.com to filter results (e.g., site:developer.mozilla.org CSS grid)\n- Use quotes for exact phrases (e.g., \"twig template\" getVar)\n- Exclude terms with minus (e.g., flexbox layout -bootstrap)",
"parameters": {
"properties": {
"query": {
"description": "Search query",
"example": "site:developer.mozilla.org CSS container queries",
"type": "string"
},
"numResults": {
"description": "Number of results to return (default: 5)",
"example": "5",
"type": "number"
},
"category": {
"description": "Optional category filter: 'news', 'github', 'pdf'",
"type": "string"
}
},
"required": ["query"],
"type": "object"
}
}
}