Skip to main content
Glama
adexltd

MCP Google Suite

by adexltd

docs_update_content

Modify text in Google Docs by replacing existing content with new text using the document ID.

Instructions

Update the content of a Google Doc

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
document_idYesID of the document
contentYesNew content

Implementation Reference

  • The tool handler function _handle_docs_update_content that extracts arguments, performs basic validation, logs the operation, calls the DocsService to update the document, 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, specifying required parameters 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"],
        },
    ),
  • The DocsService.update_document_content method that implements the core logic using Google Docs API batchUpdate to insert the new content at document index 1, effectively updating the content.
    async def update_document_content(self, document_id: str, content: str) -> Dict[str, Any]:
        """Update the content of a Google Doc."""
        try:
            service = await self.get_service()
            requests = [{"insertText": {"location": {"index": 1}, "text": content}}]
    
            result = await asyncio.to_thread(
                service.documents()
                .batchUpdate(documentId=document_id, body={"requests": requests})
                .execute
            )
    
            return {"success": True, "result": result}
        except HttpError as error:
            return {"success": False, **self.handle_error(error)}
  • Dynamic registration of tool handlers into the _tool_registry based on _handle_{tool.name} methods.
    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}")
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral context. It states the tool updates content but doesn't disclose whether this overwrites or appends, what permissions are required, if changes are reversible, or any rate limits. For a mutation tool with zero annotation coverage, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, immediately conveying the core function without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool with no annotations and no output schema, the description is incomplete. It lacks crucial context about behavioral traits, error conditions, or what the tool returns. The 100% schema coverage helps with parameters, but overall completeness is poor for a tool that modifies content.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('document_id' and 'content'). The description adds no additional meaning beyond what the schema provides, such as format examples or constraints. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Update') and resource ('content of a Google Doc'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'docs_create' or 'sheets_update_values' beyond mentioning Google Docs specifically.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of prerequisites (e.g., needing an existing document), comparison with 'docs_create' for new documents, or when to choose this over 'sheets_update_values' for spreadsheet content updates.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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