Skip to main content
Glama

get_project_users

Retrieve users linked to a specific project by providing its ID. Ideal for managing project access and collaboration on the Goodday platform through the MCP server.

Instructions

Get users associated with a specific project.

Args: project_id: The ID of the project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes

Implementation Reference

  • The handler function for the 'get_project_users' tool. It is registered via the @mcp.tool() decorator. Fetches project users from the Goodday API and formats them for output.
    async def get_project_users(project_id: str) -> str: """Get users associated with a specific project. Args: project_id: The ID of the project """ data = await make_goodday_request(f"project/{project_id}/users") if not data: return "No users found for this project." if isinstance(data, dict) and "error" in data: return f"Unable to fetch project users: {data.get('error', 'Unknown error')}" if not isinstance(data, list): return f"Unexpected response format: {str(data)}" users = [format_user(user) for user in data] return "\n---\n".join(users)
  • Helper function to format user data into a readable multi-line string, used in get_project_users to display users.
    def format_user(user: dict) -> str: """Format a user into a readable string with safe checks.""" if not isinstance(user, dict): return f"Invalid user data: {repr(user)}" # Defensive defaults in case nested keys are not dicts role = user.get('role') if isinstance(user.get('role'), dict) else {} return f""" User ID: {user.get('id', 'N/A')} Name: {user.get('name', 'N/A')} Email: {user.get('email', 'N/A')} Role: {role.get('name', 'N/A')} Status: {user.get('status', 'N/A')} """.strip()
  • Core helper function that makes authenticated HTTP requests to the Goodday API, used by get_project_users to fetch the user list.
    async def make_goodday_request(endpoint: str, method: str = "GET", data: dict = None, subfolders: bool = True) -> dict[str, Any] | list[Any] | None: """Make a request to the Goodday API with proper error handling.""" api_token = os.getenv("GOODDAY_API_TOKEN") if not api_token: raise ValueError("GOODDAY_API_TOKEN environment variable is required") headers = { "User-Agent": USER_AGENT, "gd-api-token": api_token, "Content-Type": "application/json" } # Automatically add subfolders=true for project task and document endpoints if not already present if subfolders and endpoint.startswith("project/") and ("/tasks" in endpoint or "/documents" in endpoint): if "?" in endpoint: if "subfolders=" not in endpoint: endpoint += "&subfolders=true" else: endpoint += "?subfolders=true" url = f"{GOODDAY_API_BASE}/{endpoint.lstrip('/')}" async with httpx.AsyncClient() as client: try: if method.upper() == "POST": response = await client.post(url, headers=headers, json=data, timeout=30.0) elif method.upper() == "PUT": response = await client.put(url, headers=headers, json=data, timeout=30.0) elif method.upper() == "DELETE": response = await client.delete(url, headers=headers, timeout=30.0) else: response = await client.get(url, headers=headers, timeout=30.0) response.raise_for_status() return response.json() except httpx.HTTPStatusError as e: raise Exception(f"HTTP error {e.response.status_code}: {e.response.text}") except httpx.RequestError as e: raise Exception(f"Request error: {str(e)}") except Exception as e: raise Exception(f"Unexpected error: {str(e)}")

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/cdmx-in/goodday-mcp'

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