MediaRouter / app /mcp /tools /collaboration.py
basyx's picture
Upload 629 files
1fed801 verified
Raw
History Blame Contribute Delete
1.01 kB
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
@register_tool("collaboration.list_teams")
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)
@register_tool("collaboration.create_team")
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()