Skip to main content
Glama

create_spreadsheet_comment

Add comments to Google Spreadsheets by specifying user email, spreadsheet ID, and comment content. Simplify collaboration and feedback tracking within Google Workspace.

Instructions

Create a new comment on a Google Spreadsheet.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
comment_contentYes
spreadsheet_idYes
user_google_emailYes

Implementation Reference

  • The handler function for the 'create_spreadsheet_comment' tool. It is dynamically defined for spreadsheets, decorated with authentication and error handling, and delegates to the implementation helper.
    @require_google_service("drive", "drive_file") @handle_http_errors(create_func_name, service_type="drive") async def create_comment(service, user_google_email: str, spreadsheet_id: str, comment_content: str) -> str: """Create a new comment on a Google Spreadsheet.""" return await _create_comment_impl(service, app_name, spreadsheet_id, comment_content)
  • The core implementation that uses the Google Drive API to create a comment on the specified spreadsheet, returning a formatted success message.
    async def _create_comment_impl(service, app_name: str, file_id: str, comment_content: str) -> str: """Implementation for creating a comment on any Google Workspace file.""" logger.info(f"[create_{app_name}_comment] Creating comment in {app_name} {file_id}") body = {"content": comment_content} comment = await asyncio.to_thread( service.comments().create( fileId=file_id, body=body, fields="id,content,author,createdTime,modifiedTime" ).execute ) comment_id = comment.get('id', '') author = comment.get('author', {}).get('displayName', 'Unknown') created = comment.get('createdTime', '') return f"Comment created successfully!\\nComment ID: {comment_id}\\nAuthor: {author}\\nCreated: {created}\\nContent: {comment_content}"
  • Registers the dynamically created comment tools, including 'create_spreadsheet_comment', with the MCP server.
    server.tool()(read_comments) server.tool()(create_comment) server.tool()(reply_to_comment) server.tool()(resolve_comment)
  • Triggers the creation and registration of spreadsheet-specific comment tools by calling the factory function.
    # Create comment management tools for sheets _comment_tools = create_comment_tools("spreadsheet", "spreadsheet_id") # Extract and register the functions read_sheet_comments = _comment_tools['read_comments'] create_sheet_comment = _comment_tools['create_comment'] reply_to_sheet_comment = _comment_tools['reply_to_comment'] resolve_sheet_comment = _comment_tools['resolve_comment']
  • Sets the function names dynamically, e.g., 'create_comment' to 'create_spreadsheet_comment'.
    read_comments.__name__ = read_func_name create_comment.__name__ = create_func_name reply_to_comment.__name__ = reply_func_name resolve_comment.__name__ = resolve_func_name

Other Tools

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/ZatesloFL/google_workspace_mcp'

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