Spaces:
Running
Running
| from __future__ import annotations | |
| from typing import Any | |
| from app.mcp.registry import register_tool | |
| from app.projects.services.collaboration_service import CollaborationService | |
| from app.security.context import auth_context | |
| async def list_teams(ctx: Any) -> list[dict[str, Any]]: | |
| """List all teams in the workspace.""" | |
| auth = auth_context.get() | |
| if not auth or not auth.workspace_id: | |
| raise Exception("Unauthorized") | |
| service: CollaborationService = ctx.container.collaboration | |
| return await service.list_teams(auth.workspace_id) | |
| async def create_team(ctx: Any, name: str) -> dict[str, Any]: | |
| """Create a new team in the workspace.""" | |
| auth = auth_context.get() | |
| if not auth or not auth.workspace_id: | |
| raise Exception("Unauthorized") | |
| service: CollaborationService = ctx.container.collaboration | |
| return (await service.create_team(auth.workspace_id, name)).model_dump() | |