dolibarr/htdocs/ai/assistant/execute_tool.php

80 lines
2.4 KiB
PHP
Raw Permalink Normal View History

NEW: MCP server and AI Assistant (#37888) * fix list query * Update other.lang * remove duplicate * initial commit * AI Assistant initial commit * Rename htdocs/ai/index.php to htdocs/ai/assistant/index.php * AI Assistant initial commit * Initial commit * Rename htdocs/ai/ai_assistant.css to htdocs/ai/css/ai_assistant.css * Initial commit * Rename htdocs/ai/ai_assistant.js to htdocs/ai/js/ai_assistant.js * Initial commit * Rename htdocs/ai/mcp_server.php to htdocs/ai/server/mcp_server.php * Initial commit * category tools * Rename htdocs/ai/categories.php to htdocs/ai/tools/categories.php * Global tools to restrict AI * Tools for crud actions on Dolibarr objects * Tools for products and services. * Tools to generate reports * Missing PHPDoc * Tools for thirdparties and contacts * Tool for generating navigation URLs in Dolibarr * Tools related to invoices and payments * Update ai_assistant.js * Initial commit * Rename htdocs/ai/purge_logs.php to htdocs/ai/scripts/purge_logs.php * fix pre commit * re fix pre-commit * fix pre-commit * Rename categories.php to categories.class.php * Rename conversation.php to conversation.class.php * Rename crud_objects.php to crud_objects.class.php * Rename invoices.php to invoices.class.php * Rename navigation.php to navigation.class.php * Rename products.php to products.class.php * Rename reports.php to reports.class.php * Rename thirdparty.php to thirdparty.class.php * fix pre-commit * Update parse_intent.php * fix pre commit * fix phpdoc * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * add missing phpdoc * fix pre-commit * fix phpdoc * fix phpdoc * fix pre-commit * fix pre-commit * fix phpdoc * fix pre-commit * fix pre-commit * fix phpdoc * fix phpdoc * fix phpdoc * fix phpdoc * fix php-stan * fix php-stan * fix phan * fix phan * fix phan * security check * security check * security check * security check * enhance security check * enhance security check * fix pre-commit * Update log_viewer.php * Improve access control logic in log_viewer.php Refactor access control checks for admin and module activation. * fix phan * fix phan * fix phan * fix phan * fix phan * try fix phan * fix pre-commit * fix phan * try fix phan * fix phan * fix php-stan * fix phan php-stan * fix pre-commit * fix phan php-stan * fix pre-commit * fix phan php-stan * fix phan php-stan * fix phn php-stan * fix phan php-stan * fix phan php-stan * fix phan php-stan * fix phan php-stan * fix pre-commit * fix phan php-stan * fix php-stan * Fix MCP tool registration for .class.php file naming * fix typo * fix ci * fix pre-commit * fix ci * fix pre-commit * Update categories.class.php * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * add missing user in constructor * add missing user in constructor * improve invoice validation error handling * add missing user in constructor * Rename mcp_protocol.php to mcp_protocol.class.php * Update mcp_server.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-10 23:59:55 +00:00
<?php
/* Copyright (C) 2026 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2026 Nick Fragoulis
* Copyright (C) 2026 Anthony Damhet <a.damhet@progiseize.fr>
NEW: MCP server and AI Assistant (#37888) * fix list query * Update other.lang * remove duplicate * initial commit * AI Assistant initial commit * Rename htdocs/ai/index.php to htdocs/ai/assistant/index.php * AI Assistant initial commit * Initial commit * Rename htdocs/ai/ai_assistant.css to htdocs/ai/css/ai_assistant.css * Initial commit * Rename htdocs/ai/ai_assistant.js to htdocs/ai/js/ai_assistant.js * Initial commit * Rename htdocs/ai/mcp_server.php to htdocs/ai/server/mcp_server.php * Initial commit * category tools * Rename htdocs/ai/categories.php to htdocs/ai/tools/categories.php * Global tools to restrict AI * Tools for crud actions on Dolibarr objects * Tools for products and services. * Tools to generate reports * Missing PHPDoc * Tools for thirdparties and contacts * Tool for generating navigation URLs in Dolibarr * Tools related to invoices and payments * Update ai_assistant.js * Initial commit * Rename htdocs/ai/purge_logs.php to htdocs/ai/scripts/purge_logs.php * fix pre commit * re fix pre-commit * fix pre-commit * Rename categories.php to categories.class.php * Rename conversation.php to conversation.class.php * Rename crud_objects.php to crud_objects.class.php * Rename invoices.php to invoices.class.php * Rename navigation.php to navigation.class.php * Rename products.php to products.class.php * Rename reports.php to reports.class.php * Rename thirdparty.php to thirdparty.class.php * fix pre-commit * Update parse_intent.php * fix pre commit * fix phpdoc * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * add missing phpdoc * fix pre-commit * fix phpdoc * fix phpdoc * fix pre-commit * fix pre-commit * fix phpdoc * fix pre-commit * fix pre-commit * fix phpdoc * fix phpdoc * fix phpdoc * fix phpdoc * fix php-stan * fix php-stan * fix phan * fix phan * fix phan * security check * security check * security check * security check * enhance security check * enhance security check * fix pre-commit * Update log_viewer.php * Improve access control logic in log_viewer.php Refactor access control checks for admin and module activation. * fix phan * fix phan * fix phan * fix phan * fix phan * try fix phan * fix pre-commit * fix phan * try fix phan * fix phan * fix php-stan * fix phan php-stan * fix pre-commit * fix phan php-stan * fix pre-commit * fix phan php-stan * fix phan php-stan * fix phn php-stan * fix phan php-stan * fix phan php-stan * fix phan php-stan * fix phan php-stan * fix pre-commit * fix phan php-stan * fix php-stan * Fix MCP tool registration for .class.php file naming * fix typo * fix ci * fix pre-commit * fix ci * fix pre-commit * Update categories.class.php * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * add missing user in constructor * add missing user in constructor * improve invoice validation error handling * add missing user in constructor * Rename mcp_protocol.php to mcp_protocol.class.php * Update mcp_server.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-10 23:59:55 +00:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/ai/assistant/execute_tool.php
* \ingroup ai
* \brief API endpoint for executing tools via the MCP (Model Context Protocol)
*/
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', 1);
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', 1);
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', 1);
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', 1);
}
if (!defined('NOCSRFCHECK')) { // TODO Enable the CSRF check
NEW: MCP server and AI Assistant (#37888) * fix list query * Update other.lang * remove duplicate * initial commit * AI Assistant initial commit * Rename htdocs/ai/index.php to htdocs/ai/assistant/index.php * AI Assistant initial commit * Initial commit * Rename htdocs/ai/ai_assistant.css to htdocs/ai/css/ai_assistant.css * Initial commit * Rename htdocs/ai/ai_assistant.js to htdocs/ai/js/ai_assistant.js * Initial commit * Rename htdocs/ai/mcp_server.php to htdocs/ai/server/mcp_server.php * Initial commit * category tools * Rename htdocs/ai/categories.php to htdocs/ai/tools/categories.php * Global tools to restrict AI * Tools for crud actions on Dolibarr objects * Tools for products and services. * Tools to generate reports * Missing PHPDoc * Tools for thirdparties and contacts * Tool for generating navigation URLs in Dolibarr * Tools related to invoices and payments * Update ai_assistant.js * Initial commit * Rename htdocs/ai/purge_logs.php to htdocs/ai/scripts/purge_logs.php * fix pre commit * re fix pre-commit * fix pre-commit * Rename categories.php to categories.class.php * Rename conversation.php to conversation.class.php * Rename crud_objects.php to crud_objects.class.php * Rename invoices.php to invoices.class.php * Rename navigation.php to navigation.class.php * Rename products.php to products.class.php * Rename reports.php to reports.class.php * Rename thirdparty.php to thirdparty.class.php * fix pre-commit * Update parse_intent.php * fix pre commit * fix phpdoc * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * add missing phpdoc * fix pre-commit * fix phpdoc * fix phpdoc * fix pre-commit * fix pre-commit * fix phpdoc * fix pre-commit * fix pre-commit * fix phpdoc * fix phpdoc * fix phpdoc * fix phpdoc * fix php-stan * fix php-stan * fix phan * fix phan * fix phan * security check * security check * security check * security check * enhance security check * enhance security check * fix pre-commit * Update log_viewer.php * Improve access control logic in log_viewer.php Refactor access control checks for admin and module activation. * fix phan * fix phan * fix phan * fix phan * fix phan * try fix phan * fix pre-commit * fix phan * try fix phan * fix phan * fix php-stan * fix phan php-stan * fix pre-commit * fix phan php-stan * fix pre-commit * fix phan php-stan * fix phan php-stan * fix phn php-stan * fix phan php-stan * fix phan php-stan * fix phan php-stan * fix phan php-stan * fix pre-commit * fix phan php-stan * fix php-stan * Fix MCP tool registration for .class.php file naming * fix typo * fix ci * fix pre-commit * fix ci * fix pre-commit * Update categories.class.php * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * add missing user in constructor * add missing user in constructor * improve invoice validation error handling * add missing user in constructor * Rename mcp_protocol.php to mcp_protocol.class.php * Update mcp_server.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-10 23:59:55 +00:00
define('NOCSRFCHECK', 1);
}
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/ai/class/mcp.class.php';
// Security check
if (!isModEnabled('ai') || !getDolGlobalString('AI_ASSISTANT_ENABLED')) {
NEW: MCP server and AI Assistant (#37888) * fix list query * Update other.lang * remove duplicate * initial commit * AI Assistant initial commit * Rename htdocs/ai/index.php to htdocs/ai/assistant/index.php * AI Assistant initial commit * Initial commit * Rename htdocs/ai/ai_assistant.css to htdocs/ai/css/ai_assistant.css * Initial commit * Rename htdocs/ai/ai_assistant.js to htdocs/ai/js/ai_assistant.js * Initial commit * Rename htdocs/ai/mcp_server.php to htdocs/ai/server/mcp_server.php * Initial commit * category tools * Rename htdocs/ai/categories.php to htdocs/ai/tools/categories.php * Global tools to restrict AI * Tools for crud actions on Dolibarr objects * Tools for products and services. * Tools to generate reports * Missing PHPDoc * Tools for thirdparties and contacts * Tool for generating navigation URLs in Dolibarr * Tools related to invoices and payments * Update ai_assistant.js * Initial commit * Rename htdocs/ai/purge_logs.php to htdocs/ai/scripts/purge_logs.php * fix pre commit * re fix pre-commit * fix pre-commit * Rename categories.php to categories.class.php * Rename conversation.php to conversation.class.php * Rename crud_objects.php to crud_objects.class.php * Rename invoices.php to invoices.class.php * Rename navigation.php to navigation.class.php * Rename products.php to products.class.php * Rename reports.php to reports.class.php * Rename thirdparty.php to thirdparty.class.php * fix pre-commit * Update parse_intent.php * fix pre commit * fix phpdoc * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * add missing phpdoc * fix pre-commit * fix phpdoc * fix phpdoc * fix pre-commit * fix pre-commit * fix phpdoc * fix pre-commit * fix pre-commit * fix phpdoc * fix phpdoc * fix phpdoc * fix phpdoc * fix php-stan * fix php-stan * fix phan * fix phan * fix phan * security check * security check * security check * security check * enhance security check * enhance security check * fix pre-commit * Update log_viewer.php * Improve access control logic in log_viewer.php Refactor access control checks for admin and module activation. * fix phan * fix phan * fix phan * fix phan * fix phan * try fix phan * fix pre-commit * fix phan * try fix phan * fix phan * fix php-stan * fix phan php-stan * fix pre-commit * fix phan php-stan * fix pre-commit * fix phan php-stan * fix phan php-stan * fix phn php-stan * fix phan php-stan * fix phan php-stan * fix phan php-stan * fix phan php-stan * fix pre-commit * fix phan php-stan * fix php-stan * Fix MCP tool registration for .class.php file naming * fix typo * fix ci * fix pre-commit * fix ci * fix pre-commit * Update categories.class.php * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * add missing user in constructor * add missing user in constructor * improve invoice validation error handling * add missing user in constructor * Rename mcp_protocol.php to mcp_protocol.class.php * Update mcp_server.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-10 23:59:55 +00:00
accessforbidden('Module or feature not allowed');
}
global $db, $user, $conf;
NEW: MCP server and AI Assistant (#37888) * fix list query * Update other.lang * remove duplicate * initial commit * AI Assistant initial commit * Rename htdocs/ai/index.php to htdocs/ai/assistant/index.php * AI Assistant initial commit * Initial commit * Rename htdocs/ai/ai_assistant.css to htdocs/ai/css/ai_assistant.css * Initial commit * Rename htdocs/ai/ai_assistant.js to htdocs/ai/js/ai_assistant.js * Initial commit * Rename htdocs/ai/mcp_server.php to htdocs/ai/server/mcp_server.php * Initial commit * category tools * Rename htdocs/ai/categories.php to htdocs/ai/tools/categories.php * Global tools to restrict AI * Tools for crud actions on Dolibarr objects * Tools for products and services. * Tools to generate reports * Missing PHPDoc * Tools for thirdparties and contacts * Tool for generating navigation URLs in Dolibarr * Tools related to invoices and payments * Update ai_assistant.js * Initial commit * Rename htdocs/ai/purge_logs.php to htdocs/ai/scripts/purge_logs.php * fix pre commit * re fix pre-commit * fix pre-commit * Rename categories.php to categories.class.php * Rename conversation.php to conversation.class.php * Rename crud_objects.php to crud_objects.class.php * Rename invoices.php to invoices.class.php * Rename navigation.php to navigation.class.php * Rename products.php to products.class.php * Rename reports.php to reports.class.php * Rename thirdparty.php to thirdparty.class.php * fix pre-commit * Update parse_intent.php * fix pre commit * fix phpdoc * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * add missing phpdoc * fix pre-commit * fix phpdoc * fix phpdoc * fix pre-commit * fix pre-commit * fix phpdoc * fix pre-commit * fix pre-commit * fix phpdoc * fix phpdoc * fix phpdoc * fix phpdoc * fix php-stan * fix php-stan * fix phan * fix phan * fix phan * security check * security check * security check * security check * enhance security check * enhance security check * fix pre-commit * Update log_viewer.php * Improve access control logic in log_viewer.php Refactor access control checks for admin and module activation. * fix phan * fix phan * fix phan * fix phan * fix phan * try fix phan * fix pre-commit * fix phan * try fix phan * fix phan * fix php-stan * fix phan php-stan * fix pre-commit * fix phan php-stan * fix pre-commit * fix phan php-stan * fix phan php-stan * fix phn php-stan * fix phan php-stan * fix phan php-stan * fix phan php-stan * fix phan php-stan * fix pre-commit * fix phan php-stan * fix php-stan * Fix MCP tool registration for .class.php file naming * fix typo * fix ci * fix pre-commit * fix ci * fix pre-commit * Update categories.class.php * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * add missing user in constructor * add missing user in constructor * improve invoice validation error handling * add missing user in constructor * Rename mcp_protocol.php to mcp_protocol.class.php * Update mcp_server.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-10 23:59:55 +00:00
// Per-user gate: same right as the assistant page and parse_intent.php
if (!$user->hasRight('ai', 'assistant', 'use')) {
accessforbidden();
}
NEW: MCP server and AI Assistant (#37888) * fix list query * Update other.lang * remove duplicate * initial commit * AI Assistant initial commit * Rename htdocs/ai/index.php to htdocs/ai/assistant/index.php * AI Assistant initial commit * Initial commit * Rename htdocs/ai/ai_assistant.css to htdocs/ai/css/ai_assistant.css * Initial commit * Rename htdocs/ai/ai_assistant.js to htdocs/ai/js/ai_assistant.js * Initial commit * Rename htdocs/ai/mcp_server.php to htdocs/ai/server/mcp_server.php * Initial commit * category tools * Rename htdocs/ai/categories.php to htdocs/ai/tools/categories.php * Global tools to restrict AI * Tools for crud actions on Dolibarr objects * Tools for products and services. * Tools to generate reports * Missing PHPDoc * Tools for thirdparties and contacts * Tool for generating navigation URLs in Dolibarr * Tools related to invoices and payments * Update ai_assistant.js * Initial commit * Rename htdocs/ai/purge_logs.php to htdocs/ai/scripts/purge_logs.php * fix pre commit * re fix pre-commit * fix pre-commit * Rename categories.php to categories.class.php * Rename conversation.php to conversation.class.php * Rename crud_objects.php to crud_objects.class.php * Rename invoices.php to invoices.class.php * Rename navigation.php to navigation.class.php * Rename products.php to products.class.php * Rename reports.php to reports.class.php * Rename thirdparty.php to thirdparty.class.php * fix pre-commit * Update parse_intent.php * fix pre commit * fix phpdoc * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * add missing phpdoc * fix pre-commit * fix phpdoc * fix phpdoc * fix pre-commit * fix pre-commit * fix phpdoc * fix pre-commit * fix pre-commit * fix phpdoc * fix phpdoc * fix phpdoc * fix phpdoc * fix php-stan * fix php-stan * fix phan * fix phan * fix phan * security check * security check * security check * security check * enhance security check * enhance security check * fix pre-commit * Update log_viewer.php * Improve access control logic in log_viewer.php Refactor access control checks for admin and module activation. * fix phan * fix phan * fix phan * fix phan * fix phan * try fix phan * fix pre-commit * fix phan * try fix phan * fix phan * fix php-stan * fix phan php-stan * fix pre-commit * fix phan php-stan * fix pre-commit * fix phan php-stan * fix phan php-stan * fix phn php-stan * fix phan php-stan * fix phan php-stan * fix phan php-stan * fix phan php-stan * fix pre-commit * fix phan php-stan * fix php-stan * Fix MCP tool registration for .class.php file naming * fix typo * fix ci * fix pre-commit * fix ci * fix pre-commit * Update categories.class.php * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * add missing user in constructor * add missing user in constructor * improve invoice validation error handling * add missing user in constructor * Rename mcp_protocol.php to mcp_protocol.class.php * Update mcp_server.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-10 23:59:55 +00:00
top_httphead('application/json');
try {
$raw = file_get_contents('php://input');
$input = json_decode($raw, true);
if (!$input || empty($input['tool'])) {
throw new Exception("Invalid Request: No tool specified.");
}
// Initialize Handler with the private assistant context so that the correct
// allow-list (AI_ASSISTANT_ALLOWED_TOOLS) is enforced on both schema and execution.
$mcp = new McpHandler($db, $user, $conf, McpHandler::CTX_ASSISTANT);
NEW: MCP server and AI Assistant (#37888) * fix list query * Update other.lang * remove duplicate * initial commit * AI Assistant initial commit * Rename htdocs/ai/index.php to htdocs/ai/assistant/index.php * AI Assistant initial commit * Initial commit * Rename htdocs/ai/ai_assistant.css to htdocs/ai/css/ai_assistant.css * Initial commit * Rename htdocs/ai/ai_assistant.js to htdocs/ai/js/ai_assistant.js * Initial commit * Rename htdocs/ai/mcp_server.php to htdocs/ai/server/mcp_server.php * Initial commit * category tools * Rename htdocs/ai/categories.php to htdocs/ai/tools/categories.php * Global tools to restrict AI * Tools for crud actions on Dolibarr objects * Tools for products and services. * Tools to generate reports * Missing PHPDoc * Tools for thirdparties and contacts * Tool for generating navigation URLs in Dolibarr * Tools related to invoices and payments * Update ai_assistant.js * Initial commit * Rename htdocs/ai/purge_logs.php to htdocs/ai/scripts/purge_logs.php * fix pre commit * re fix pre-commit * fix pre-commit * Rename categories.php to categories.class.php * Rename conversation.php to conversation.class.php * Rename crud_objects.php to crud_objects.class.php * Rename invoices.php to invoices.class.php * Rename navigation.php to navigation.class.php * Rename products.php to products.class.php * Rename reports.php to reports.class.php * Rename thirdparty.php to thirdparty.class.php * fix pre-commit * Update parse_intent.php * fix pre commit * fix phpdoc * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * fix pre-commit * add missing phpdoc * fix pre-commit * fix phpdoc * fix phpdoc * fix pre-commit * fix pre-commit * fix phpdoc * fix pre-commit * fix pre-commit * fix phpdoc * fix phpdoc * fix phpdoc * fix phpdoc * fix php-stan * fix php-stan * fix phan * fix phan * fix phan * security check * security check * security check * security check * enhance security check * enhance security check * fix pre-commit * Update log_viewer.php * Improve access control logic in log_viewer.php Refactor access control checks for admin and module activation. * fix phan * fix phan * fix phan * fix phan * fix phan * try fix phan * fix pre-commit * fix phan * try fix phan * fix phan * fix php-stan * fix phan php-stan * fix pre-commit * fix phan php-stan * fix pre-commit * fix phan php-stan * fix phan php-stan * fix phn php-stan * fix phan php-stan * fix phan php-stan * fix phan php-stan * fix phan php-stan * fix pre-commit * fix phan php-stan * fix php-stan * Fix MCP tool registration for .class.php file naming * fix typo * fix ci * fix pre-commit * fix ci * fix pre-commit * Update categories.class.php * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * add missing user in constructor * add missing user in constructor * improve invoice validation error handling * add missing user in constructor * Rename mcp_protocol.php to mcp_protocol.class.php * Update mcp_server.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-10 23:59:55 +00:00
$result = $mcp->executeTool($input['tool'], $input['arguments'] ?? []);
echo json_encode($result);
} catch (Throwable $e) {
// Set HTTP response code to error (400 Bad Request)
http_response_code(400);
echo json_encode(["error" => $e->getMessage()]);
}