Skip to main content
Glama

Backlog MCP Server

getDocumentTree.test.ts2.07 kB
import { getDocumentTreeTool } from './getDocumentTree.js'; import { jest, describe, it, expect } from '@jest/globals'; import type { Backlog } from 'backlog-js'; import { createTranslationHelper } from '../createTranslationHelper.js'; // export const DocumentTreeFullSchema = z.object({ // projectId: z.string(), // activeTree: ActiveTrashTreeSchema.optional(), // trashTree: ActiveTrashTreeSchema.optional(), // }); describe('getDocumentTreeTool', () => { const mockBacklog: Partial<Backlog> = { getDocumentTree: jest.fn<() => Promise<any>>().mockResolvedValue({ projectId: 1, activeTree: { id: 'Active', children: [ { id: '01934345404771adb2113d7792bb4351', name: 'local test', children: [ { id: '019347fc760c7b0abff04b44628c94d7', name: 'test2', children: [ { id: '0192ff5990da76c289dee06b1f11fa01', name: 'aaatest234', children: [], emoji: '', }, ], emoji: '', }, ], emoji: '', }, ], }, trashTree: {}, }), }; const mockTranslationHelper = createTranslationHelper(); const tool = getDocumentTreeTool( mockBacklog as Backlog, mockTranslationHelper ); it('returns document tree as formatted JSON text', async () => { const result = await tool.handler({ projectIdOrKey: 'TEST_PROJECT' }); if (Array.isArray(result)) { throw new Error('Unexpected array result'); } expect(result.projectId).toEqual(1); expect(result.activeTree?.children).toHaveLength(1); expect(result.activeTree?.children[0].children).toHaveLength(1); }); it('calls backlog.getDocumentTree with correct params', async () => { await tool.handler({ projectIdOrKey: 'TEST_PROJECT' }); expect(mockBacklog.getDocumentTree).toHaveBeenCalledWith('TEST_PROJECT'); }); });

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/nulab/backlog-mcp-server'

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