read_google_document
Extract content from a Google Docs document using its unique document ID. Enables AI models to retrieve text and data for processing or analysis through the Google Docs MCP Server.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| documentId | Yes | 読み取るGoogle DocsドキュメントのID |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"documentId": {
"description": "読み取るGoogle DocsドキュメントのID",
"type": "string"
}
},
"required": [
"documentId"
],
"type": "object"
}
Implementation Reference
- src/mcp/tools/readDocument.ts:28-53 (handler)The executeInternal method implements the tool's core logic: validates args, logs, fetches GoogleDocsService, reads document content, logs success, returns response or throws error.protected async executeInternal(args: { documentId: string; }): Promise<McpToolResponse> { // 引数検証 this.validateArgs(args, ["documentId"]); const { documentId } = args; this.logger.info(`ドキュメント読み取り開始: ${documentId}`); try { // Google Docsサービスを取得 const docsService = await this.serviceContainer.getGoogleDocsService(); // ドキュメント内容を取得 const content = await docsService.readDocumentContent(documentId); this.logger.info( `ドキュメント読み取り完了: ${documentId}, 文字数: ${content.length}`, ); return this.createSuccessResponse(content); } catch (error) { this.logger.error(`ドキュメント読み取りエラー: ${documentId}`, error); throw error; // BaseMcpToolでエラーハンドリング } }
- src/mcp/tools/readDocument.ts:19-23 (schema)Defines the input schema using Zod for the documentId parameter.get schema() { return { documentId: z.string().describe("読み取るGoogle DocsドキュメントのID"), }; }
- src/mcp/registry.ts:53-53 (registration)Registers the ReadDocumentTool instance in the ToolRegistry's registerDefaultTools method.this.registerTool(new ReadDocumentTool(this.serviceContainer));
- src/mcp/tools/readDocument.ts:11-14 (registration)The class constructor sets the tool name 'read_google_document' via BaseMcpTool super call.export class ReadDocumentTool extends BaseMcpTool { constructor(serviceContainer: IServiceContainer) { super("read_google_document", serviceContainer); }