File tree Expand file tree Collapse file tree
packages/server/api/src/app/ai/mcp Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { createAxiosHeaders } from '@openops/common' ;
22import { AppSystemProp , system } from '@openops/server-shared' ;
3+ import { isEmpty } from '@openops/shared' ;
34import { experimental_createMCPClient as createMCPClient , ToolSet } from 'ai' ;
45import { openopsTables } from '../../openops-tables' ;
56import { authenticateAdminUserInOpenOpsTables } from '../../openops-tables/auth-admin-tables' ;
67import { MCPTool } from './types' ;
78
89export async function getTablesTools ( ) : Promise < MCPTool > {
910 const { token } = await authenticateAdminUserInOpenOpsTables ( ) ;
10- const mcpEndpoint = await openopsTables . getMcpEndpointList ( token ) ;
11- if ( ! mcpEndpoint ) {
11+ const mcpEndpoints = await openopsTables . getMcpEndpointList ( token ) ;
12+ if ( isEmpty ( mcpEndpoints ) ) {
1213 return {
1314 client : undefined ,
1415 toolSet : { } ,
@@ -17,7 +18,7 @@ export async function getTablesTools(): Promise<MCPTool> {
1718
1819 const url =
1920 system . get ( AppSystemProp . OPENOPS_TABLES_API_URL ) +
20- `/openops-tables/mcp/${ mcpEndpoint [ 0 ] . key } /sse` ;
21+ `/openops-tables/mcp/${ mcpEndpoints [ 0 ] . key } /sse` ;
2122
2223 const client = await createMCPClient ( {
2324 transport : {
You can’t perform that action at this time.
0 commit comments