'object', 'properties' => [ 'content' => [ 'type' => 'string', 'description' => 'The knowledge to remember (max 50,000 characters)', 'maxLength' => 50000, ], 'type' => [ 'type' => 'string', 'description' => 'Memory type classification', 'enum' => BrainMemory::VALID_TYPES, ], 'tags' => [ 'type' => 'array', 'items' => ['type' => 'string'], 'description' => 'Optional tags for categorisation', ], 'project' => [ 'type' => 'string', 'description' => 'Optional project scope (e.g. repo name)', ], 'confidence' => [ 'type' => 'number', 'description' => 'Confidence level from 0.0 to 1.0 (default: 0.8)', 'minimum' => 0.0, 'maximum' => 1.0, ], 'supersedes' => [ 'type' => 'string', 'format' => 'uuid', 'description' => 'UUID of an older memory this one replaces', ], 'expires_in' => [ 'type' => 'integer', 'description' => 'Hours until this memory expires (null = never)', 'minimum' => 1, ], ], 'required' => ['content', 'type'], ]; } public function handle(array $args, array $context = []): array { $workspaceId = $context['workspace_id'] ?? null; if ($workspaceId === null) { return $this->error('workspace_id is required. Ensure you have authenticated with a valid API key. See: https://host.uk.com/ai'); } $agentId = $context['agent_id'] ?? $context['session_id'] ?? 'anonymous'; return $this->withCircuitBreaker('brain', function () use ($args, $workspaceId, $agentId) { $memory = RememberKnowledge::run($args, (int) $workspaceId, $agentId); return $this->success([ 'memory' => $memory->toMcpContext(), ]); }, fn () => $this->error('Brain service temporarily unavailable. Memory could not be stored.', 'service_unavailable')); } }