test_connection
Verify connectivity to the embedding service to ensure proper functionality of semantic search and document processing capabilities.
Instructions
Test the connection to the embedding service
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "test_connection"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:482-492 (handler)Main handler function for the 'test_connection' tool. Delegates to RAGService.testEmbeddingService() and returns formatted MCP response with connection status.
private async handleTestConnection() { const isConnected = await this.ragService.testEmbeddingService(); return { content: [ { type: 'text', text: JSON.stringify({ connected: isConnected }, null, 2), }, ], }; } - src/index.ts:211-218 (schema)Tool registration entry including schema definition. Defines 'test_connection' tool with empty input schema (no parameters required).
{ name: 'test_connection', description: 'Test the connection to the embedding service', inputSchema: { type: 'object', properties: {}, }, }, - src/index.ts:275-277 (registration)Dispatch registration in CallToolRequestHandler switch statement that routes 'test_connection' calls to the handler.
case 'test_connection': return await this.handleTestConnection(); - src/services/ragService.ts:263-270 (helper)RAGService helper method that calls EmbeddingService.testConnection() with error handling.
async testEmbeddingService(): Promise<boolean> { try { return await this.embeddingService.testConnection(); } catch (error) { logger.error(`Embedding service test failed: ${error}`); return false; } } - Core test implementation in EmbeddingService. Generates a test embedding and validates its dimension matches expected CONFIG.EMBEDDING_DIMENSION.
async testConnection(): Promise<boolean> { try { const testEmbedding = await this.generateSingleEmbedding('test'); return testEmbedding.length === CONFIG.EMBEDDING_DIMENSION; } catch (error) { logger.error(`Embedding service test failed: ${error}`); return false; } }