Skip to main content
Glama

get_users_by_project_id

Retrieve all users associated with a specific project ID using the MCP service integrated with Mantis Bug Tracker for efficient user data management and analysis.

Instructions

獲取指定專案的所有用戶

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYes專案 ID

Implementation Reference

  • src/server.ts:404-416 (registration)
    Registration of the 'get_users_by_project_id' tool using server.tool, including description, input schema, and handler function.
    server.tool(
      "get_users_by_project_id",
      "獲取指定專案的所有用戶",
      {
        projectId: z.number().describe("專案 ID"),
      },
      async (params) => {
        return withMantisConfigured("get_users_by_project_id", async () => {
          const users = await mantisApi.getUsersByProjectId(params.projectId);
          return JSON.stringify(users, null, 2);
        });
      }
    );
  • The MCP tool handler function that validates Mantis configuration, calls the mantisApi helper, and returns JSON stringified users.
    async (params) => {
      return withMantisConfigured("get_users_by_project_id", async () => {
        const users = await mantisApi.getUsersByProjectId(params.projectId);
        return JSON.stringify(users, null, 2);
      });
    }
  • Zod input schema defining the required 'projectId' parameter.
    {
      projectId: z.number().describe("專案 ID"),
    },
  • Helper function in MantisApi class that fetches users for a given project ID via API call with caching support.
    async getUsersByProjectId(projectId: number): Promise<User[]> {
      log.info('獲取指定專案的所有使用者', { projectId });
      
      const cacheKey = `users-by-project-${projectId}`;
      
      return this.cachedRequest<User[]>(cacheKey, () => {
        return this.api.get(`/projects/${projectId}/users`);
      });
    }
  • TypeScript interface defining the User object structure returned by the tool.
    export interface User {
      id: number;
      name: string;
      email: string;
      real_name?: string;
      access_level?: {
        id: number;
        name: string;
      };
      enabled?: boolean;
    }
Install Server

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