-
Notifications
You must be signed in to change notification settings - Fork 16
feat: add RPC request handling endpoint #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||
| import { Request, Response } from 'express'; | ||||||||||||||||||||||||||||||||||||||||||||||||
| import { mcpController } from './mcp.controller'; | ||||||||||||||||||||||||||||||||||||||||||||||||
| import { falkorDBService } from '../services/falkordb.service'; | ||||||||||||||||||||||||||||||||||||||||||||||||
| import { mcpController } from './mcp.controller'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| // Mock the falkorDBService | ||||||||||||||||||||||||||||||||||||||||||||||||
| jest.mock('../services/falkordb.service', () => ({ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -10,6 +10,11 @@ jest.mock('../services/falkordb.service', () => ({ | |||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| // Mock uuid | ||||||||||||||||||||||||||||||||||||||||||||||||
| jest.mock('uuid', () => ({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| v4: jest.fn(() => 'test-uuid') | ||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| describe('MCP Controller', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| let mockRequest: Partial<Request>; | ||||||||||||||||||||||||||||||||||||||||||||||||
| let mockResponse: Partial<Response>; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -25,7 +30,8 @@ describe('MCP Controller', () => { | |||||||||||||||||||||||||||||||||||||||||||||||
| mockStatus = jest.fn().mockReturnThis(); | ||||||||||||||||||||||||||||||||||||||||||||||||
| mockResponse = { | ||||||||||||||||||||||||||||||||||||||||||||||||
| json: mockJson, | ||||||||||||||||||||||||||||||||||||||||||||||||
| status: mockStatus | ||||||||||||||||||||||||||||||||||||||||||||||||
| status: mockStatus, | ||||||||||||||||||||||||||||||||||||||||||||||||
| header: jest.fn().mockReturnThis() | ||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -129,4 +135,217 @@ describe('MCP Controller', () => { | |||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| describe('initialize', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| test('should return 400 if jsonrpc version is invalid', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| mockRequest = { | ||||||||||||||||||||||||||||||||||||||||||||||||
| body: { | ||||||||||||||||||||||||||||||||||||||||||||||||
| jsonrpc: '1.0', | ||||||||||||||||||||||||||||||||||||||||||||||||
| id: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||
| method: 'initialize' | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.initialize(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockStatus).toHaveBeenCalledWith(400); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockJson).toHaveBeenCalledWith(expect.objectContaining({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| error: expect.objectContaining({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| code: -32600 | ||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| test('should initialize session successfully', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| mockRequest = { | ||||||||||||||||||||||||||||||||||||||||||||||||
| body: { | ||||||||||||||||||||||||||||||||||||||||||||||||
| jsonrpc: '2.0', | ||||||||||||||||||||||||||||||||||||||||||||||||
| id: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||
| method: 'initialize' | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.initialize(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockResponse.header).toHaveBeenCalledWith('Mcp-Session-Id', expect.any(String)); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockStatus).toHaveBeenCalledWith(200); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockJson).toHaveBeenCalledWith(expect.objectContaining({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| result: expect.objectContaining({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| serverInfo: expect.objectContaining({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| name: 'FalkorDB MCP Server' | ||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| describe('processMetadataRequest', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| test('should return metadata', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.processMetadataRequest(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockStatus).toHaveBeenCalledWith(200); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockJson).toHaveBeenCalledWith(expect.objectContaining({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| provider: 'FalkorDB MCP Server', | ||||||||||||||||||||||||||||||||||||||||||||||||
| capabilities: expect.any(Array) | ||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+182
to
+192
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Proposed fix describe('processMetadataRequest', () => {
test('should return metadata', async () => {
+ mockRequest = {};
await mcpController.processMetadataRequest(mockRequest as Request, mockResponse as Response);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| describe('handleRpcRequest', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| test('should delegate initialize', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| mockRequest = { body: { method: 'initialize', jsonrpc: '2.0', id: 1 } }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| const spy = jest.spyOn(mcpController, 'initialize'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.handleRpcRequest(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(spy).toHaveBeenCalled(); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| test('should handle notifications/initialized', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| mockRequest = { body: { method: 'notifications/initialized', jsonrpc: '2.0' } }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.handleRpcRequest(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockStatus).toHaveBeenCalledWith(200); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockJson).toHaveBeenCalledWith(expect.objectContaining({ result: true })); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| test('should handle ping', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| mockRequest = { body: { method: 'ping', jsonrpc: '2.0', id: 1 } }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.handleRpcRequest(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockStatus).toHaveBeenCalledWith(200); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockJson).toHaveBeenCalledWith(expect.objectContaining({ result: {} })); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| test('should handle tools/list', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| mockRequest = { body: { method: 'tools/list', jsonrpc: '2.0', id: 1 } }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.handleRpcRequest(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockStatus).toHaveBeenCalledWith(200); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockJson).toHaveBeenCalledWith(expect.objectContaining({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| result: expect.objectContaining({ tools: expect.any(Array) }) | ||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| test('should handle resources/list', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| mockRequest = { body: { method: 'resources/list', jsonrpc: '2.0', id: 1 } }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.handleRpcRequest(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockStatus).toHaveBeenCalledWith(200); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| test('should handle prompts/list', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| mockRequest = { body: { method: 'prompts/list', jsonrpc: '2.0', id: 1 } }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.handleRpcRequest(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockStatus).toHaveBeenCalledWith(200); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| test('should return error for unknown method', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| mockRequest = { body: { method: 'unknown', jsonrpc: '2.0', id: 1 } }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.handleRpcRequest(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockStatus).toHaveBeenCalledWith(200); // It returns 200 with error body | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockJson).toHaveBeenCalledWith(expect.objectContaining({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| error: expect.objectContaining({ code: -32601 }) | ||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| describe('tools/call', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| test('should return error if tool not found', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| mockRequest = { | ||||||||||||||||||||||||||||||||||||||||||||||||
| body: { | ||||||||||||||||||||||||||||||||||||||||||||||||
| method: 'tools/call', | ||||||||||||||||||||||||||||||||||||||||||||||||
| jsonrpc: '2.0', | ||||||||||||||||||||||||||||||||||||||||||||||||
| id: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||
| params: { name: 'unknown_tool', arguments: {} } | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.handleRpcRequest(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockJson).toHaveBeenCalledWith(expect.objectContaining({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| error: expect.objectContaining({ code: -32601 }) | ||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| test('graph_query success', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| (falkorDBService.executeQuery as jest.Mock).mockResolvedValue([{ id: 1 }]); | ||||||||||||||||||||||||||||||||||||||||||||||||
| mockRequest = { | ||||||||||||||||||||||||||||||||||||||||||||||||
| body: { | ||||||||||||||||||||||||||||||||||||||||||||||||
| method: 'tools/call', | ||||||||||||||||||||||||||||||||||||||||||||||||
| jsonrpc: '2.0', | ||||||||||||||||||||||||||||||||||||||||||||||||
| id: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||
| params: { name: 'graph_query', arguments: { graphName: 'g', query: 'match n return n' } } | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.handleRpcRequest(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(falkorDBService.executeQuery).toHaveBeenCalledWith('g', 'match n return n', {}); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockJson).toHaveBeenCalledWith(expect.objectContaining({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| result: expect.objectContaining({ content: expect.any(Array) }) | ||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| test('list_graphs success', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| (falkorDBService.listGraphs as jest.Mock).mockResolvedValue(['g1']); | ||||||||||||||||||||||||||||||||||||||||||||||||
| mockRequest = { | ||||||||||||||||||||||||||||||||||||||||||||||||
| body: { | ||||||||||||||||||||||||||||||||||||||||||||||||
| method: 'tools/call', | ||||||||||||||||||||||||||||||||||||||||||||||||
| jsonrpc: '2.0', | ||||||||||||||||||||||||||||||||||||||||||||||||
| id: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||
| params: { name: 'list_graphs', arguments: {} } | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.handleRpcRequest(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(falkorDBService.listGraphs).toHaveBeenCalled(); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockJson).toHaveBeenCalledWith(expect.objectContaining({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| result: expect.objectContaining({ content: expect.any(Array) }) | ||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| test('get_graph_schema success', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| (falkorDBService.executeQuery as jest.Mock).mockImplementation((graph, query) => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| if (query.includes('labels')) return Promise.resolve([{ label: 'Person' }]); | ||||||||||||||||||||||||||||||||||||||||||||||||
| if (query.includes('relationshipTypes')) return Promise.resolve([{ relationshipType: 'KNOWS' }]); | ||||||||||||||||||||||||||||||||||||||||||||||||
| if (query.includes('MATCH')) return Promise.resolve([]); | ||||||||||||||||||||||||||||||||||||||||||||||||
| return Promise.resolve([]); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| mockRequest = { | ||||||||||||||||||||||||||||||||||||||||||||||||
| body: { | ||||||||||||||||||||||||||||||||||||||||||||||||
| method: 'tools/call', | ||||||||||||||||||||||||||||||||||||||||||||||||
| jsonrpc: '2.0', | ||||||||||||||||||||||||||||||||||||||||||||||||
| id: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||
| params: { name: 'get_graph_schema', arguments: { graphName: 'g' } } | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.handleRpcRequest(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockJson).toHaveBeenCalledWith(expect.objectContaining({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| result: expect.objectContaining({ content: expect.any(Array) }) | ||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| test('get_node_properties success', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| (falkorDBService.executeQuery as jest.Mock).mockResolvedValue([{ props: {} }]); | ||||||||||||||||||||||||||||||||||||||||||||||||
| mockRequest = { | ||||||||||||||||||||||||||||||||||||||||||||||||
| body: { | ||||||||||||||||||||||||||||||||||||||||||||||||
| method: 'tools/call', | ||||||||||||||||||||||||||||||||||||||||||||||||
| jsonrpc: '2.0', | ||||||||||||||||||||||||||||||||||||||||||||||||
| id: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||
| params: { name: 'get_node_properties', arguments: { graphName: 'g', label: 'L' } } | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.handleRpcRequest(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockJson).toHaveBeenCalledWith(expect.objectContaining({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| result: expect.objectContaining({ content: expect.any(Array) }) | ||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| test('get_relationship_properties success', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| (falkorDBService.executeQuery as jest.Mock).mockResolvedValue([{ props: {} }]); | ||||||||||||||||||||||||||||||||||||||||||||||||
| mockRequest = { | ||||||||||||||||||||||||||||||||||||||||||||||||
| body: { | ||||||||||||||||||||||||||||||||||||||||||||||||
| method: 'tools/call', | ||||||||||||||||||||||||||||||||||||||||||||||||
| jsonrpc: '2.0', | ||||||||||||||||||||||||||||||||||||||||||||||||
| id: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||
| params: { name: 'get_relationship_properties', arguments: { graphName: 'g', relationshipType: 'R' } } | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| await mcpController.handleRpcRequest(mockRequest as Request, mockResponse as Response); | ||||||||||||||||||||||||||||||||||||||||||||||||
| expect(mockJson).toHaveBeenCalledWith(expect.objectContaining({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| result: expect.objectContaining({ content: expect.any(Array) }) | ||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.