create_invitation
Invite users to projects or organizations by email, assign roles, and include custom messages for collaboration setup.
Instructions
Invite users to project or organization by email
Args: scope_type: Whether to invite users to organization or project scope_name: Name of the organization or project to invite users to role: Role to assign to invited users emails: List of email addresses to invite extra_invitation_text: Custom message to include in the invitation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scope_type | Yes | ||
| scope_name | Yes | ||
| role | Yes | ||
| emails | Yes | ||
| extra_invitation_text | No |
Implementation Reference
- src/waldur_mcp_server/server.py:97-149 (handler)Handler function for the 'create_invitation' tool, decorated with @mcp.tool() for registration. It resolves roles, scopes (customer/project), and creates invitations using the Waldur API client.@mcp.tool() async def create_invitation( scope_type: Literal["customer", "project"], scope_name: str, role: str, emails: list[str], extra_invitation_text: str = "", ) -> list[Invitation]: """Invite users to project or organization by email Args: scope_type: Whether to invite users to organization or project scope_name: Name of the organization or project to invite users to role: Role to assign to invited users emails: List of email addresses to invite extra_invitation_text: Custom message to include in the invitation """ matching_roles = await roles_list.asyncio(client=client, description=role) if not matching_roles: raise ValueError(f"Role '{role}' not found") role_uuid = matching_roles[0]["uuid"] if scope_type == "customer": matching_customers = await customers_list.asyncio( client=client, name=scope_name ) if not matching_customers: raise ValueError(f"Customer '{scope_name}' not found") scope_url = matching_customers[0]["url"] elif scope_type == "project": matching_projects = await projects_list.asyncio(client=client, name=scope_name) if not matching_projects: raise ValueError(f"Project '{scope_name}' not found") scope_url = matching_projects[0]["url"] if not scope_url: raise ValueError(f"Invalid scope type: {scope_type}") results = [] for email in emails: result = await user_invitations_create.asyncio( client=client, body=InvitationRequest( scope=scope_url, role=role_uuid, email=email, extra_invitation_text=extra_invitation_text, ), ) results.append(result) return results