Skip to main content
Glama
penysho

Google Docs MCP Server

by penysho

update_google_document

Modify Google Docs by inserting or updating content at specified positions using a document ID. Streamline document editing with precise control over content changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes追加または更新するコンテンツ
documentIdYes更新するGoogle DocsドキュメントのID
endPositionNo更新を終了する位置(オプション)
startPositionNo更新を開始する位置(オプション)

Implementation Reference

  • The handler function that performs the actual Google Document update using the Google Docs service.
    protected async executeInternal(args: {
    	documentId: string;
    	content: string;
    	startPosition?: number;
    	endPosition?: number;
    }): Promise<McpToolResponse> {
    	// 引数検証
    	this.validateArgs(args, ["documentId", "content"]);
    
    	const { documentId, content, startPosition, endPosition } = args;
    	this.logger.info(
    		`ドキュメント更新開始: ${documentId}, 位置: ${startPosition}-${endPosition}`,
    	);
    
    	try {
    		// Google Docsサービスを取得
    		const docsService = await this.serviceContainer.getGoogleDocsService();
    
    		// ドキュメントを更新
    		await docsService.updateDocumentContent(
    			documentId,
    			content,
    			startPosition,
    			endPosition,
    		);
    
    		this.logger.info(`ドキュメント更新完了: ${documentId}`);
    
    		return this.createSuccessResponse("ドキュメントが更新されました");
    	} catch (error) {
    		this.logger.error(`ドキュメント更新エラー: ${documentId}`, error);
    		throw error; // BaseMcpToolでエラーハンドリング
    	}
    }
  • Defines the Zod schema for input validation of the tool parameters: documentId, content, optional startPosition and endPosition.
    get schema() {
    	return {
    		documentId: z.string().describe("更新するGoogle DocsドキュメントのID"),
    		content: z.string().describe("追加または更新するコンテンツ"),
    		startPosition: z
    			.number()
    			.optional()
    			.describe("更新を開始する位置(オプション)"),
    		endPosition: z
    			.number()
    			.optional()
    			.describe("更新を終了する位置(オプション)"),
    	};
    }
  • Registers an instance of UpdateDocumentTool in the tool registry during default tools setup.
    this.registerTool(new UpdateDocumentTool(this.serviceContainer));
Behavior1/5

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

Tool has no description.

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

Conciseness1/5

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

Tool has no description.

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

Completeness1/5

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

Tool has no description.

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

Parameters1/5

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

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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

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/penysho/docs-mcp'

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