Skip to main content
Glama

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

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

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "content": { "description": "追加または更新するコンテンツ", "type": "string" }, "documentId": { "description": "更新するGoogle DocsドキュメントのID", "type": "string" }, "endPosition": { "description": "更新を終了する位置(オプション)", "type": "number" }, "startPosition": { "description": "更新を開始する位置(オプション)", "type": "number" } }, "required": [ "documentId", "content" ], "type": "object" }

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));

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