Skip to main content
Glama
get-rules.test.ts1.97 kB
import { getClient } from '../setup/jest.setup'; import { MCPTestHelper } from '../test-utils/jest-mcp-helper'; describe('Get Rules Tool', () => { let client: MCPTestHelper; beforeAll(() => { client = getClient(); }); test('should return only requested documentation sections', async () => { const result = await client.testGetRules(["quickStart", "tools"]); expect(result).toBeDefined(); expect(typeof result).toBe('object'); expect(result).toHaveProperty('quickStart'); expect(result).toHaveProperty('tools'); expect(result).not.toHaveProperty('commonErrors'); expect(result).not.toHaveProperty('interactions'); }); test('should return single rule when requested', async () => { const result = await client.testGetRules(["commonErrors"]); expect(result).toBeDefined(); expect(typeof result).toBe('object'); expect(result).toHaveProperty('commonErrors'); expect(Object.keys(result)).toHaveLength(1); }); test('should return all requested rules', async () => { const allRules = [ "quickStart", "commonErrors", "interactions", "tools", "workflow", "performanceOptimization", "gamingTips", "debuggingWithPuppeteer" ]; const result = await client.testGetRules(allRules); expect(result).toBeDefined(); expect(typeof result).toBe('object'); allRules.forEach(rule => { expect(result).toHaveProperty(rule); }); }); test('should handle empty rules array', async () => { const result = await client.testGetRules([]); expect(result).toBeDefined(); expect(typeof result).toBe('object'); expect(Object.keys(result)).toHaveLength(0); }); test('should default to quickStart when no rules provided', async () => { const result = await client.testGetRules(); expect(result).toBeDefined(); expect(typeof result).toBe('object'); expect(result).toHaveProperty('quickStart'); }); });

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/matiasngf/mcp-fetch'

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