dolibarr 24.0.0-beta
ToolThirdParty Class Reference

Class ToolThirdParty. More...

Inheritance diagram for ToolThirdParty:
Collaboration diagram for ToolThirdParty:

Public Member Functions

 __construct ($db, $user)
 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

 search (array $args, int $count=0)
 Search for third parties based on provided criteria.
 
 getDetails (array $args)
 Fetch details for a specific third party (Societe).
 
 listContacts (array $args)
 List all contacts for a given thirdparty.
 
 addContact (array $args)
 Add a contact linked to a thirdparty.
 

Detailed Description

Class ToolThirdParty.

Provides various tools related to Dolibarr categories.

Definition at line 34 of file thirdparty.class.php.

Constructor & Destructor Documentation

◆ __construct()

ToolThirdParty::__construct ( $db,
$user )

Constructor.

Parameters
DoliDB$dbDatabase handler
User$userUser object for permission checks

Definition at line 43 of file thirdparty.class.php.

References user.

Member Function Documentation

◆ addContact()

ToolThirdParty::addContact ( array $args)
private

Add a contact linked to a thirdparty.

Parameters
array{thirdparty_identifier:int|string,firstname:string,lastname:string,email?:string,phone?:string}$args Arguments array (identifier, firstname, lastname required).
Returns
array{status:string,message:string,id:int,url?:string}|array{error:string}

Definition at line 625 of file thirdparty.class.php.

References string, and user.

Referenced by execute().

◆ execute()

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

Executes the requested tool function based on its name.

Parameters
string$nameThe name of the tool to execute.
array<string,mixed>$args The arguments for the tool (key-value pairs).
Returns
mixed The result of the tool execution (usually an array) or an error array.

Reimplemented from McpTool.

Definition at line 187 of file thirdparty.class.php.

References addContact(), getDetails(), listContacts(), and search().

◆ getCategories()

ToolThirdParty::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 175 of file thirdparty.class.php.

◆ getDefinitions()

ToolThirdParty::getDefinitions ( )

Returns an array of tool definitions, including name, description, and input schema.

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

Reimplemented from McpTool.

Definition at line 54 of file thirdparty.class.php.

◆ getDetails()

ToolThirdParty::getDetails ( array $args)
private

Fetch details for a specific third party (Societe).

Parameters
array{idint|string} $args Arguments array containing the thirdparty ID.
Returns
array{error:string}|array<string,mixed>

Definition at line 335 of file thirdparty.class.php.

References string, and user.

Referenced by execute().

◆ listContacts()

ToolThirdParty::listContacts ( array $args)
private

List all contacts for a given thirdparty.

Parameters
array{idint|string} $args Arguments array containing the thirdparty ID.
Returns
array{error: string}|list<array<string, int|string>>

Definition at line 545 of file thirdparty.class.php.

References dol_syslog(), getEntity(), string, and user.

Referenced by execute().

◆ search()

ToolThirdParty::search ( array $args,
int $count = 0 )
private

Search for third parties based on provided criteria.

Parameters
array{query:string|int,type?:string,country_code?:string,limit?:int|string}$args Array of arguments:
  • query: Search string or ID
  • country_code: ISO country code on 2 chars (FR, US, GR...)
  • type: 'customer', 'prospect', 'supplier'
  • limit: Limit results (default 5)
int$countIf set to 1, returns only the count of results.
Returns
array{error:string}|array{count:int}|list<array{id:int,name:string,alias:string,code_cust:string,code_sup:string,email:string,type:string,url:string}>

Definition at line 220 of file thirdparty.class.php.

References dol_syslog(), getEntity(), string, and user.

Referenced by execute().


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