|
dolibarr 24.0.0-beta
|
Tool class for CRUD operations on Dolibarr objects TODO Remove all tools in this file. More...


Public Member Functions | |
| __construct (DoliDB $db) | |
| Constructor. | |
| getDefinitions () | |
| Returns an array of tool definitions, including name, description, and input schema. | |
| getCategories () | |
| Return categories this tool belongs to. | |
| execute (string $name, array $args) | |
| Executes the requested tool function based on its name. | |
Public Member Functions inherited from McpTool | |
| __construct ($db, $user, $conf) | |
| Constructor. | |
| isSystem () | |
| Return true if this is a system/infrastructure tool that must always remain visible and executable regardless of the admin allow-list. | |
Private Member Functions | |
| addLineItem (array $args) | |
| Entry point for the 'add_line_item' tool. | |
| findProduct ($identifier) | |
| Find a product by various identifiers (ID, Ref, Barcode, Label). | |
| deleteObject (array $args) | |
| Delete a document object. | |
| checkPermission (string $type) | |
| Check if the current user has permission for the given object type. | |
| instantiate (string $type) | |
| Factory Helper to instantiate Dolibarr objects. | |
Tool class for CRUD operations on Dolibarr objects TODO Remove all tools in this file.
Must be into the objectname.class.php to follow the same structure than APIs.
Definition at line 35 of file crud_objects.class.php.
| ToolCrudObjects::__construct | ( | DoliDB | $db | ) |
|
private |
Entry point for the 'add_line_item' tool.
Adds line to an already existing object. Instantiates the document and calls the line processing helper.
| array{object_type:string,parent_id:int,product_id?:int,description?:string,quantity?:float|int,unit_price?:float|int,vat_rate?:float|int} | $args Tool arguments for adding a line item |
Definition at line 689 of file crud_objects.class.php.
References string.
Referenced by execute().
|
private |
Check if the current user has permission for the given object type.
| string | $type | Object type key. |
Definition at line 875 of file crud_objects.class.php.
References user.
|
private |
Delete a document object.
| array{object_type | string, id: int|string} $args Arguments containing type and ID. |
Definition at line 830 of file crud_objects.class.php.
Referenced by execute().
| ToolCrudObjects::execute | ( | string | $name, |
| array | $args ) |
Executes the requested tool function based on its name.
| string | $name | The name of the tool to execute. |
| array<string,mixed> | $args The arguments for the tool (key-value pairs). |
Reimplemented from McpTool.
Definition at line 323 of file crud_objects.class.php.
References $conf, $mysoc, addLineItem(), deleteObject(), and user.
|
private |
Find a product by various identifiers (ID, Ref, Barcode, Label).
| string | int | $identifier | The search term (ID, ref, barcode, etc.). |
Definition at line 738 of file crud_objects.class.php.
References getEntity().
| ToolCrudObjects::getCategories | ( | ) |
Return categories this tool belongs to.
Used by the intent parser to filter available tools.
Reimplemented from McpTool.
Definition at line 311 of file crud_objects.class.php.
| ToolCrudObjects::getDefinitions | ( | ) |
Returns an array of tool definitions, including name, description, and input schema.
Reimplemented from McpTool.
Definition at line 140 of file crud_objects.class.php.
|
private |
Factory Helper to instantiate Dolibarr objects.
| string | $type | Object type key (e.g., 'proposal', 'invoice'). |
| Exception | If the type is unknown or class not found. |
Definition at line 895 of file crud_objects.class.php.
References string.