docs_get_content
Retrieve content from Google Docs using document ID to access and work with text data in Google Workspace.
Instructions
Get the contents of a Google Doc
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document_id | Yes | ID of the document |
Implementation Reference
- src/mcp_google_suite/server.py:325-338 (handler)The handler function that implements the 'docs_get_content' tool logic. It validates the document_id argument and delegates to DocsService.get_document_content to fetch the document content.async def _handle_docs_get_content( self, context: GoogleWorkspaceContext, arguments: dict ) -> Dict[str, Any]: """Handle docs get content requests.""" document_id = arguments.get("document_id") if not document_id: raise ValueError("Document ID is required") logger.debug(f"Getting document content - ID: {document_id}") result = await context.docs.get_document_content(document_id=document_id) logger.debug("Document content retrieved successfully") return result
- Input schema definition for the 'docs_get_content' tool, requiring a 'document_id' string parameter.types.Tool( name="docs_get_content", description="Get the contents of a Google Doc", inputSchema={ "type": "object", "properties": { "document_id": {"type": "string", "description": "ID of the document"} }, "required": ["document_id"], }, ),
- src/mcp_google_suite/server.py:177-182 (registration)Code block that dynamically registers the handler for 'docs_get_content' (and other tools) by matching _handle_{tool.name} and adding to _tool_registry.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}")