Skip to main content
Glama
talhaorak

Taiga MCP Bridge

by talhaorak

invite_project_user

Enable project collaboration by inviting users via email with assigned roles. Streamline user onboarding for Taiga projects through automated invitations.

Instructions

Invites a user to a project by email with a specific role.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYes
project_idYes
role_idYes
session_idYes

Implementation Reference

  • The handler function for the 'invite_project_user' MCP tool. It authenticates the session, validates input, calls the Taiga API's memberships.invite method to send an invitation by email to a project with a specified role, handles errors, and returns the result.
    @mcp.tool("invite_project_user", description="Invites a user to a project by email with a specific role.")
    def invite_project_user(session_id: str, project_id: int, email: str, role_id: int) -> Dict[str, Any]:
        """Invites a user via email to join the project with the specified role ID."""
        logger.info(
            f"Executing invite_project_user {email} to project {project_id} (role {role_id}), session {session_id[:8]}...")
        taiga_client_wrapper = _get_authenticated_client(session_id) # Use wrapper variable name
        if not email:
            raise ValueError("Email cannot be empty.")
        try:
            # Use pytaigaclient memberships resource invite method
            # Check pytaigaclient signature for param names (project, email, role_id)
            invitation_result = taiga_client_wrapper.api.memberships.invite(
                project=project_id, email=email, role_id=role_id # Changed project_id to project
            )
            logger.info(f"Invitation request sent to {email} for project {project_id}.")
            # Return the result from the invite call (might be dict or status)
            return invitation_result if isinstance(invitation_result, dict) else {"status": "invited", "email": email, "details": invitation_result}
        except TaigaException as e:
            logger.error(
                f"Taiga API error inviting user {email} to project {project_id}: {e}", exc_info=False)
            raise e
        except Exception as e:
            logger.error(
                f"Unexpected error inviting user {email} to project {project_id}: {e}", exc_info=True)
            raise RuntimeError(f"Server error inviting user: {e}")
  • Shared helper function used by 'invite_project_user' (and other tools) to retrieve and validate the TaigaClientWrapper instance for the given session_id, raising PermissionError if invalid.
    def _get_authenticated_client(session_id: str) -> TaigaClientWrapper:
        """
        Retrieves the authenticated TaigaClientWrapper for a given session ID.
        Raises PermissionError if the session is invalid or not found.
        """
        client = active_sessions.get(session_id)
        # Also check if the client object itself exists and is authenticated
        if not client or not client.is_authenticated:
            logger.warning(f"Invalid or expired session ID provided: {session_id}")
            # Raise PermissionError - FastMCP will map this to an appropriate error response
            raise PermissionError(
                f"Invalid or expired session ID: '{session_id}'. Please login again.")
        logger.debug(f"Retrieved valid client for session ID: {session_id}")
        return client
  • The @mcp.tool decorator registers the 'invite_project_user' function as an MCP tool with the specified name and description.
    @mcp.tool("invite_project_user", description="Invites a user to a project by email with a specific role.")

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/talhaorak/pytaiga-mcp'

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