Skip to main content
Glama

get_users

Retrieve all user data from Mantis Bug Tracker using brute-force methods for comprehensive user analysis and integration.

Instructions

用暴力法強制取得所有用戶

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'get_users' tool. It uses a brute-force approach by sequentially fetching users starting from ID 1 via mantisApi.getUser(id) until encountering 10 consecutive 404 errors, then returns the collected users as JSON.
    async () => { return withMantisConfigured("get_users", async () => { let notFoundCount = 0; let id = 1; let users: User[] = []; do { try { const user = await mantisApi.getUser(id); users.push(user); id++; notFoundCount = 0; // 重置計數器 } catch (error) { if (error instanceof MantisApiError && error.statusCode === 404) { notFoundCount++; id++; } } } while (notFoundCount < 10); return JSON.stringify(users, null, 2); }); }
  • src/server.ts:420-444 (registration)
    Registration of the MCP 'get_users' tool on the McpServer instance, including description, empty input schema, and inline handler.
    "get_users", "用暴力法強制取得所有用戶", {}, async () => { return withMantisConfigured("get_users", async () => { let notFoundCount = 0; let id = 1; let users: User[] = []; do { try { const user = await mantisApi.getUser(id); users.push(user); id++; notFoundCount = 0; // 重置計數器 } catch (error) { if (error instanceof MantisApiError && error.statusCode === 404) { notFoundCount++; id++; } } } while (notFoundCount < 10); return JSON.stringify(users, null, 2); }); } );
  • TypeScript interface defining the User type, used for typing the users array returned by the tool.
    export interface User { id: number; name: string; email: string; real_name?: string; access_level?: { id: number; name: string; }; enabled?: boolean; }
  • mantisApi.getUser(userId) helper function that fetches a single user by ID from the Mantis API (with caching), repeatedly called in the tool's brute-force loop.
    async getUser(userId: number): Promise<User> { log.info('獲取用戶信息', { userId }); if (!userId) { throw new MantisApiError('必須提供用戶 ID'); } const cacheKey = `user-${userId}`; return this.cachedRequest<User>(cacheKey, () => { return this.api.get(`/users/${userId}`); }); }

Other Tools

Related Tools

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/kfnzero/mantis-mcp-server'

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