add_watcher
Add a user as a watcher to monitor updates and changes in a specific work package within OpenProject.
Instructions
Add a user as a watcher to a work package.
Args:
work_package_id: Work package ID
user_id: User ID to add as watcher
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| work_package_id | Yes | ||
| user_id | Yes |
Implementation Reference
- Core implementation of add_watcher: Posts to OpenProject API to add user as watcher to work package.async def add_watcher(work_package_id: int, user_id: int) -> dict[str, Any]: """Add a user as a watcher to a work package. Args: work_package_id: Work package ID user_id: User ID to add as watcher Returns: Updated work package with watchers information """ client = OpenProjectClient() try: payload = {"user": build_link(f"/api/v3/users/{user_id}")} result = await client.post( f"work_packages/{work_package_id}/watchers", data=payload ) return result finally: await client.close()
- src/openproject_mcp/server.py:137-147 (registration)Tool registration via @mcp.tool() decorator. Thin wrapper delegating to work_packages.add_watcher.@mcp.tool() async def add_watcher(work_package_id: int, user_id: int): """Add a user as a watcher to a work package. Args: work_package_id: Work package ID user_id: User ID to add as watcher """ return await work_packages.add_watcher( work_package_id=work_package_id, user_id=user_id )