fix: pass workspace context from API key to tool execution

Brain tools require workspace_id in context for data isolation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Snider 2026-03-04 07:41:03 +00:00
parent b112b5357a
commit 8138840cad

View file

@ -222,10 +222,16 @@ class McpApiController extends Controller
throw new \RuntimeException("Tool not found: {$tool}");
}
$context = [];
if ($apiKey?->workspace_id) {
$context['workspace_id'] = $apiKey->workspace_id;
}
return $registry->execute(
name: $tool,
args: $arguments,
context: [],
context: $context,
apiKey: $apiKey,
validateDependencies: false
);