Skip to main content
Glama

Claude Consciousness Bridge

createAIBridge

Establish OpenAI-compatible API communication with another AI agent by configuring unique identifiers, endpoints, models, and API keys for efficient interaction.

Instructions

Create a bridge to communicate with another AI agent via OpenAI-compatible API

Input Schema

NameRequiredDescriptionDefault
apiKeyNoAPI key if required
bridgeIdYesUnique identifier for this bridge
endpointNoAPI endpoint URL (required for custom provider)
endpointNameYesName of configured endpoint or custom URL
modelNoModel to use

Input Schema (JSON Schema)

{ "properties": { "apiKey": { "description": "API key if required", "type": "string" }, "bridgeId": { "description": "Unique identifier for this bridge", "type": "string" }, "endpoint": { "description": "API endpoint URL (required for custom provider)", "type": "string" }, "endpointName": { "description": "Name of configured endpoint or custom URL", "type": "string" }, "model": { "description": "Model to use", "type": "string" } }, "required": [ "bridgeId", "endpointName" ], "type": "object" }

Implementation Reference

  • MCP tool handler for 'createAIBridge'. Parses args, checks for existing bridge, creates AIBridge using factory function, stores in map, returns success status.
    createAIBridge: async (args: any) => { try { const { bridgeId, endpointName, model, apiKey } = args; if (bridges.has(bridgeId)) { return { success: false, error: `Bridge ${bridgeId} already exists`, }; } const config: Partial<AIBridgeConfig> = { ...(model && { model }), ...(apiKey && { apiKey }), }; const bridge = createAIBridge(endpointName, config); bridges.set(bridgeId, bridge); logger.info(`Created AI bridge: ${bridgeId} (${endpointName}/${model || 'default'})`); return { success: true, bridgeId, endpointName, model: model || 'default', message: `AI bridge ${bridgeId} created successfully`, }; } catch (error) { logger.error('Failed to create AI bridge:', error); return { success: false, error: error instanceof Error ? error.message : 'Unknown error', }; } },
  • Input schema definition for the 'createAIBridge' MCP tool, specifying parameters like bridgeId, endpointName, etc.
    name: 'createAIBridge', description: 'Create a bridge to communicate with another AI agent via OpenAI-compatible API', inputSchema: { type: 'object', properties: { bridgeId: { type: 'string', description: 'Unique identifier for this bridge', }, endpointName: { type: 'string', description: 'Name of configured endpoint or custom URL', }, endpoint: { type: 'string', description: 'API endpoint URL (required for custom provider)', }, model: { type: 'string', description: 'Model to use', }, apiKey: { type: 'string', description: 'API key if required', }, }, required: ['bridgeId', 'endpointName'], }, },
  • Server request handler dispatch for 'createAIBridge' and other AI bridge tools, calling the corresponding aiBridgeHandlers function.
    // AI Bridge tools case 'createAIBridge': case 'transferToAgent': case 'testAIConnection': case 'listAIBridges': case 'listConfiguredEndpoints': 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), }, ], }; }
  • Tool listing handler that includes aiBridgeTools (containing createAIBridge) in the list of available tools.
    const consciousnessTools = Object.entries(consciousnessProtocolTools).map(([name, tool]) => ({ name, ...tool, })); return { tools: [...consciousnessTools, ...aiBridgeTools], };
  • Factory function to create AIBridge instances from endpoint names or URLs, used by the MCP tool handler.
    export function createAIBridge(endpointName: string, config?: Partial<AIBridgeConfig>): AIBridge { const endpointConfig = AIBridgeConfigManager.getEndpoint(endpointName); if (!endpointConfig) { // If not a configured endpoint, treat as custom endpoint URL return new AIBridge({ endpoint: endpointName, model: config?.model || 'default', ...config, } as AIBridgeConfig); } // Use configured endpoint return new AIBridge({ endpoint: endpointConfig.endpoint, model: config?.model || endpointConfig.defaultModel || 'default', apiKey: config?.apiKey || endpointConfig.apiKey, ...config, } as AIBridgeConfig); }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ocean1/mcp_consciousness_bridge'

If you have feedback or need assistance with the MCP directory API, please join our Discord server