dolibarr 24.0.0-beta
mcp_server.php File Reference

File of the MCP Server service. More...

Go to the source code of this file.

Functions

 mcp_log_request (array $req, $resp, float $tStart, string $rawInput)
 Persist an MCP tools/call invocation to the llx_ai_request_log table.
 

Detailed Description

File of the MCP Server service.

Definition in file mcp_server.php.

Function Documentation

◆ mcp_log_request()

mcp_log_request ( array $req,
$resp,
float $tStart,
string $rawInput )

Persist an MCP tools/call invocation to the llx_ai_request_log table.

Mirrors what parse_intent.php does for the web AI Assistant. Only tools/call is logged – lifecycle methods (initialize, ping, notifications/initialized, tools/list, ...) are skipped to avoid noise.

Parameters
array<string,mixed>$req The JSON-RPC request
?mixed$respThe JSON-RPC response (null for notifications)
float$tStartmicrotime(true) captured before processing
string$rawInputRaw request body
Returns
void No return value, only logs the request

Definition at line 168 of file mcp_server.php.

References $db, ai_log_request(), dol_substr(), and string.