docs_update_content
Update content within a Google Doc by specifying the document ID and new text, enabling efficient content management and integration with Google Workspace via the MCP Google Suite server.
Instructions
Update the content of a Google Doc
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | New content | |
| document_id | Yes | ID of the document |
Input Schema (JSON Schema)
{
"properties": {
"content": {
"description": "New content",
"type": "string"
},
"document_id": {
"description": "ID of the document",
"type": "string"
}
},
"required": [
"document_id",
"content"
],
"type": "object"
}
Implementation Reference
- src/mcp_google_suite/server.py:339-354 (handler)The MCP tool handler function that extracts arguments, validates them, calls DocsService.update_document_content, and returns the result.async def _handle_docs_update_content( self, context: GoogleWorkspaceContext, arguments: dict ) -> Dict[str, Any]: """Handle docs update content requests.""" document_id = arguments.get("document_id") content = arguments.get("content") if not document_id or content is None: raise ValueError("Both document_id and content are required") logger.debug(f"Updating document - ID: {document_id}, Content length: {len(content)}") result = await context.docs.update_document_content( document_id=document_id, content=content ) logger.debug("Document content updated successfully") return result
- The input schema definition for the docs_update_content tool, defining properties and required fields for document_id and content.types.Tool( name="docs_update_content", description="Update the content of a Google Doc", inputSchema={ "type": "object", "properties": { "document_id": {"type": "string", "description": "ID of the document"}, "content": {"type": "string", "description": "New content"}, }, "required": ["document_id", "content"], }, ),
- src/mcp_google_suite/server.py:176-182 (registration)Dynamic registration loop that adds the tool handler to the internal registry based on the tools list and existence of _handle_<name> method.# Register tool handlers for tool in self._get_tools_list(): handler_name = f"_handle_{tool.name}" if hasattr(self, handler_name): handler = getattr(self, handler_name) self._tool_registry[tool.name] = handler logger.debug(f"Registered handler for {tool.name}")