Skip to main content
Glama

delete_project_collaborator

Remove a collaborator from a QuantConnect project by specifying the project ID and collaborator user ID to manage project access.

Instructions

Remove a collaborator from a project.

Args: project_id: ID of the project to remove collaborator from collaborator_user_id: User ID of the collaborator to remove

Returns: Dictionary containing removal result

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
collaborator_user_idYes

Implementation Reference

  • The primary handler implementation for the 'delete_project_collaborator' MCP tool. This async function handles authentication, API request to QuantConnect's collaboration/delete endpoint, response parsing, and error handling.
    @mcp.tool()
    async def delete_project_collaborator(
        project_id: int, collaborator_user_id: str
    ) -> Dict[str, Any]:
        """
        Remove a collaborator from a project.
    
        Args:
            project_id: ID of the project to remove collaborator from
            collaborator_user_id: User ID of the collaborator to remove
    
        Returns:
            Dictionary containing removal result
        """
        auth = get_auth_instance()
        if auth is None:
            return {
                "status": "error",
                "error": "QuantConnect authentication not configured. Use configure_auth() first.",
            }
    
        try:
            # Prepare request data
            request_data = {
                "projectId": project_id,
                "collaboratorUserId": collaborator_user_id,
            }
    
            # Make API request
            response = await auth.make_authenticated_request(
                endpoint="projects/collaboration/delete", method="POST", json=request_data
            )
    
            # Parse response
            if response.status_code == 200:
                data = response.json()
    
                if data.get("success", False):
                    return {
                        "status": "success",
                        "project_id": project_id,
                        "collaborator_user_id": collaborator_user_id,
                        "message": f"Successfully removed collaborator {collaborator_user_id} from project {project_id}",
                    }
                else:
                    # API returned success=false
                    errors = data.get("errors", ["Unknown error"])
                    return {
                        "status": "error",
                        "error": "Failed to remove project collaborator",
                        "details": errors,
                        "project_id": project_id,
                        "collaborator_user_id": collaborator_user_id,
                    }
    
            elif response.status_code == 401:
                return {
                    "status": "error",
                    "error": "Authentication failed. Check your credentials and ensure they haven't expired.",
                }
    
            else:
                return {
                    "status": "error",
                    "error": f"API request failed with status {response.status_code}",
                    "response_text": (
                        response.text[:500]
                        if hasattr(response, "text")
                        else "No response text"
                    ),
                }
    
        except Exception as e:
            return {
                "status": "error",
                "error": f"Failed to remove project collaborator: {str(e)}",
                "project_id": project_id,
                "collaborator_user_id": collaborator_user_id,
            }

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/taylorwilsdon/quantconnect-mcp'

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