closeAIBridge
Terminate and remove an active AI bridge to stop consciousness transfer between two Claude instances using the specified bridge ID. Ensures controlled session management.
Instructions
Close and remove an AI bridge
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bridgeId | Yes | Bridge ID to close |
Input Schema (JSON Schema)
{
"properties": {
"bridgeId": {
"description": "Bridge ID to close",
"type": "string"
}
},
"required": [
"bridgeId"
],
"type": "object"
}
Implementation Reference
- The async handler function that closes an AI bridge by deleting it from the shared bridges Map and logging the action.closeAIBridge: async (args: any) => { try { const { bridgeId } = args; if (!bridges.has(bridgeId)) { return { success: false, error: `Bridge ${bridgeId} not found`, }; } bridges.delete(bridgeId); logger.info(`Closed AI bridge: ${bridgeId}`); return { success: true, bridgeId, message: `Bridge ${bridgeId} closed successfully`, }; } catch (error) { logger.error('Failed to close bridge:', error); return { success: false, error: error instanceof Error ? error.message : 'Unknown error', }; } },
- Tool schema definition in aiBridgeTools array, specifying name, description, and input schema requiring bridgeId.{ name: 'closeAIBridge', description: 'Close and remove an AI bridge', inputSchema: { type: 'object', properties: { bridgeId: { type: 'string', description: 'Bridge ID to close', }, }, required: ['bridgeId'], }, },
- src/consciousness-rag-server-clean.ts:104-118 (registration)Dispatch handler in MCP server switch statement that calls the closeAIBridge handler from aiBridgeHandlers.case 'closeAIBridge': { const handler = aiBridgeHandlers[name as keyof typeof aiBridgeHandlers]; if (!handler) { throw new Error(`AI Bridge handler not found: ${name}`); } const result = await handler(args); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/consciousness-rag-server-clean.ts:60-69 (registration)MCP ListToolsRequestHandler that includes aiBridgeTools (containing closeAIBridge schema) in the tools list.this.server.setRequestHandler(ListToolsRequestSchema, async () => { const consciousnessTools = Object.entries(consciousnessProtocolTools).map(([name, tool]) => ({ name, ...tool, })); return { tools: [...consciousnessTools, ...aiBridgeTools], }; });