forked from core/php-mcp
fix: wrap logToolCall in try-catch to prevent cascading failures
Matches the pattern used by logApiRequest and recordQuotaUsage. Without this, a missing mcp_tool_calls table causes the entire API response to fail even when tool execution succeeds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f37aa26654
commit
b112b5357a
1 changed files with 14 additions and 9 deletions
|
|
@ -307,15 +307,20 @@ class McpApiController extends Controller
|
|||
bool $success,
|
||||
?string $error = null
|
||||
): void {
|
||||
McpToolCall::log(
|
||||
serverId: $request['server'],
|
||||
toolName: $request['tool'],
|
||||
params: $request['arguments'] ?? [],
|
||||
success: $success,
|
||||
durationMs: $durationMs,
|
||||
errorMessage: $error,
|
||||
workspaceId: $apiKey?->workspace_id
|
||||
);
|
||||
try {
|
||||
McpToolCall::log(
|
||||
serverId: $request['server'],
|
||||
toolName: $request['tool'],
|
||||
params: $request['arguments'] ?? [],
|
||||
success: $success,
|
||||
durationMs: $durationMs,
|
||||
errorMessage: $error,
|
||||
workspaceId: $apiKey?->workspace_id
|
||||
);
|
||||
} catch (\Throwable $e) {
|
||||
// Don't let logging failures affect API response
|
||||
report($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue