Skip to main content
Glama
fetch-build-log-tail.test.ts1.1 kB
import { getRequiredTool } from '@/tools'; // Mock TeamCity API client to provide a deterministic full log jest.mock('@/api-client', () => { const fullLogLines = Array.from({ length: 10 }, (_, i) => `line ${i + 1}`); const getBuildLog = jest.fn(() => Promise.resolve(fullLogLines.join('\n'))); return { TeamCityAPI: { getInstance: () => ({ getBuildLog, }), }, }; }); describe('fetch_build_log tail mode', () => { it('returns the last N lines with correct metadata', async () => { const res = await getRequiredTool('fetch_build_log').handler({ buildId: 'b1', tail: true, lineCount: 3, }); const payload = JSON.parse((res.content?.[0]?.text as string) ?? '{}'); expect(payload.lines).toEqual(['line 8', 'line 9', 'line 10']); expect(payload.meta.mode).toBe('tail'); expect(payload.meta.pageSize).toBe(3); expect(payload.meta.startLine).toBe(7); // 0-based index of 'line 8' expect(payload.meta.totalLines).toBe(10); expect(payload.meta.hasMore).toBe(true); // There are earlier lines available }); });

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/Daghis/teamcity-mcp'

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