Add create_comment tool to Basecamp integration

Updated mcp_server_cli.py to include the new tool in the CLI and modified README.md to document the new functionality. Adjusted test_cli_server.py to include the create_comment tool in the expected tools list.
This commit is contained in:
George Antonopoulos
2025-09-11 20:50:06 +01:00
parent c3c96712e6
commit e91e0031b9
4 changed files with 58 additions and 1 deletions

View File

@@ -526,6 +526,38 @@ async def get_comments(recording_id: str, project_id: str) -> Dict[str, Any]:
"message": str(e)
}
@mcp.tool()
async def create_comment(recording_id: str, project_id: str, content: str) -> Dict[str, Any]:
"""Create a comment on a Basecamp item.
Args:
recording_id: The item ID
project_id: The project ID
content: The comment content in HTML format
"""
client = _get_basecamp_client()
if not client:
return _get_auth_error_response()
try:
comment = await _run_sync(client.create_comment, recording_id, project_id, content)
return {
"status": "success",
"comment": comment,
"message": "Comment created successfully"
}
except Exception as e:
logger.error(f"Error creating comment: {e}")
if "401" in str(e) and "expired" in str(e).lower():
return {
"error": "OAuth token expired",
"message": "Your Basecamp OAuth token expired during the API call. Please re-authenticate by visiting http://localhost:8000 and completing the OAuth flow again.",
}
return {
"error": "Execution error",
"message": str(e)
}
@mcp.tool()
async def get_campfire_lines(project_id: str, campfire_id: str) -> Dict[str, Any]:
"""Get recent messages from a Basecamp campfire (chat room).