|
dolibarr 24.0.0-beta
|
Abstract base class for all MCP (Model Context Protocol) tools. More...

Public Member Functions | |
| __construct ($db, $user, $conf) | |
| Constructor. | |
| getDefinitions () | |
| Return the list of tools provided by this class. | |
| execute (string $toolName, array $args) | |
| Execute a specific tool. | |
| getCategories () | |
| Return categories this tool belongs to. | |
| isSystem () | |
| Return true if this is a system/infrastructure tool that must always remain visible and executable regardless of the admin allow-list. | |
Abstract base class for all MCP (Model Context Protocol) tools.
All AI tools must extend this class. It provides a standard interface for defining tool capabilities and executing them, along with common utility methods for interacting with Dolibarr.
Definition at line 32 of file mcptool.class.php.
| McpTool::__construct | ( | $db, | |
| $user, | |||
| $conf ) |
|
abstract |
Execute a specific tool.
This method must be implemented by child classes to contain the logic for executing the tools defined in getDefinitions.
| string | $toolName | The name of the tool to execute. |
| array<string,mixed> | $args Associative array of arguments for the tool. |
Reimplemented in ToolCategories, ToolConversation, ToolCrudObjects, ToolInvoices, ToolNavigation, ToolProducts, ToolReports, and ToolThirdParty.
| McpTool::getCategories | ( | ) |
Return categories this tool belongs to.
Used by the intent parser to filter available tools.
Reimplemented in ToolCategories, ToolConversation, ToolCrudObjects, ToolInvoices, ToolNavigation, ToolProducts, ToolReports, and ToolThirdParty.
Definition at line 86 of file mcptool.class.php.
|
abstract |
Return the list of tools provided by this class.
This method must be implemented by child classes to define their capabilities. It should return an array of tool definitions, typically in a JSON schema format.
Reimplemented in ToolCategories, ToolConversation, ToolCrudObjects, ToolInvoices, ToolNavigation, ToolProducts, ToolReports, and ToolThirdParty.
Referenced by McpHandler\registerTool().
| McpTool::isSystem | ( | ) |
Return true if this is a system/infrastructure tool that must always remain visible and executable regardless of the admin allow-list.
The default is false. Override and return true in any tool class that provides core assistant communication functions (clarification, confirmation, responses, etc.).
McpHandler calls this method at runtime — no tool names are hardcoded anywhere. Adding a new system tool class in the future requires only overriding this method in that class; no changes to McpHandler are needed.
Reimplemented in ToolConversation.
Definition at line 105 of file mcptool.class.php.