dolibarr 24.0.0-beta
ToolConversation Class Reference
Inheritance diagram for ToolConversation:
Collaboration diagram for ToolConversation:

Public Member Functions

 getDefinitions ()
 Defines the conversational tools available to the AI.
 
 getCategories ()
 Return categories this tool belongs to.
 
 isSystem ()
 Conversation tools are system-level infrastructure.
 
 execute (string $name, array $args)
 Executes a conversational tool.
 
- Public Member Functions inherited from McpTool
 __construct ($db, $user, $conf)
 Constructor.
 

Detailed Description

Definition at line 29 of file conversation.class.php.

Member Function Documentation

◆ execute()

ToolConversation::execute ( string $name,
array $args )

Executes a conversational tool.

Since these tools don't perform backend actions, this method simply packages the provided arguments into a structured array for the MCP server to send to the client.

Parameters
string$nameThe name of the tool to execute.
array<string,mixed>$args The arguments for the tool (key-value pairs).
Returns
array{tool: string, arguments: array<string, mixed>}|null A structured command array or null if the tool is not found.

Reimplemented from McpTool.

Definition at line 143 of file conversation.class.php.

◆ getCategories()

ToolConversation::getCategories ( )

Return categories this tool belongs to.

Used by the intent parser to filter available tools.

Returns
array<string> List of categories (e.g., ['billing', 'commercial'])

Reimplemented from McpTool.

Definition at line 110 of file conversation.class.php.

◆ getDefinitions()

ToolConversation::getDefinitions ( )

Defines the conversational tools available to the AI.

These tools control the interaction flow with the end-user.

Returns
list<array<string, mixed>> Array of tool definitions.

Reimplemented from McpTool.

Definition at line 37 of file conversation.class.php.

◆ isSystem()

ToolConversation::isSystem ( )

Conversation tools are system-level infrastructure.

They must always be available so the assistant can communicate with the user (send replies, ask clarifying questions, request confirmation for destructive actions, reject out-of-scope queries) regardless of which tools are enabled or disabled in the admin allow-list.

McpHandler reads this at runtime — no tool names are hardcoded there. Any future tool class that provides similar infrastructure simply overrides this method to return true; no other file needs to change.

Returns
bool

Reimplemented from McpTool.

Definition at line 128 of file conversation.class.php.


The documentation for this class was generated from the following file: