Skip to main content
Glama
listDatasources.test.ts1.82 kB
import { MCPServerStdio } from '@openai/agents'; import dotenv from 'dotenv'; import z from 'zod'; import { dataSourceSchema } from '../../src/sdks/tableau/types/dataSource.js'; import { Datasource } from '../constants.js'; import { getDefaultEnv, getSuperstoreDatasource, resetEnv, setEnv } from '../testEnv.js'; import { getCallToolResult, getMcpServer, getModel, getToolExecutions } from './base.js'; import { grade } from './grade.js'; describe('list-datasources', () => { let mcpServer: MCPServerStdio; let superstore: Datasource; beforeAll(setEnv); afterAll(resetEnv); beforeAll(async () => { dotenv.config({ path: 'tests/eval/.env' }); }); beforeEach(async () => { const env = getDefaultEnv(); superstore = getSuperstoreDatasource(env); mcpServer = await getMcpServer(env); }); afterEach(async () => { await mcpServer?.close(); }); it('should call list_datasources tool', async () => { const prompt = 'List the data sources that are available on my Tableau site. Do not perform any analysis on the the list of data sources, just show the list.'; const { agentResult } = await grade({ mcpServer, model: getModel(), prompt, }); const toolExecutions = await getToolExecutions(agentResult); expect(toolExecutions.length).toBe(1); expect(toolExecutions[0].name).toBe('list_datasources'); expect(toolExecutions[0].arguments.filter).toBeFalsy(); const datasources = getCallToolResult(toolExecutions[0], z.array(dataSourceSchema)); expect(datasources.length).greaterThan(0); const datasource = datasources.find( (datasource) => datasource.name === 'Superstore Datasource', ); expect(datasource).toMatchObject({ id: superstore.id, name: 'Superstore Datasource', }); }); });

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/datalabs89/tableau-mcp'

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