Skip to main content
Glama
by adexltd

docs_get_content

Extract text content from a Google Doc by providing its document ID using secure OAuth2 authentication through MCP Google Suite integration.

Instructions

Get the contents of a Google Doc

Input Schema

NameRequiredDescriptionDefault
document_idYesID of the document

Input Schema (JSON Schema)

{ "properties": { "document_id": { "description": "ID of the document", "type": "string" } }, "required": [ "document_id" ], "type": "object" }

Implementation Reference

  • MCP tool handler function that validates input, logs the request, calls the DocsService to retrieve document content, and returns the result.
    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
  • Tool schema definition including input schema requiring 'document_id'.
    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"], }, ),
  • Dynamic registration loop that registers the _handle_docs_get_content handler for the 'docs_get_content' tool based on the tools list.
    # 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}")
  • Core helper method in DocsService that fetches the Google Doc content using the Docs API (note: called as get_document_content in handler, likely corresponding implementation).
    async def get_document(self, document_id: str) -> Dict[str, Any]: """Get the contents of a Google Doc.""" try: service = await self.get_service() document = await asyncio.to_thread( service.documents().get(documentId=document_id).execute ) return {"success": True, "document": document} except HttpError as error: return {"success": False, **self.handle_error(error)}

Other Tools

Related 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/adexltd/mcp-google-suite'

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