MCP Tools Reference: drivemcp.googleapis.com

ツール: read_file_content

このツールを呼び出して、ドライブ ファイルの自然言語表現を取得します。必要に応じて、コメントも取得できます。

ファイルが非常に大きい場合、ファイルの内容が不完全になることがあります。テキスト表現は時間とともに変化するため、このツールから返されるテキストの特定の形式を想定しないでください。サポートされている場合、コメントタグがコンテンツに含まれます。

サポートされている MIME タイプ:

  • application/vnd.google-apps.document
  • application/vnd.google-apps.presentation
  • application/vnd.google-apps.spreadsheet
  • application/pdf
  • application/msword
  • application/vnd.openxmlformats-officedocument.wordprocessingml.document
  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • application/vnd.openxmlformats-officedocument.presentationml.presentation
  • application/vnd.oasis.opendocument.spreadsheet
  • application/vnd.oasis.opendocument.presentation
  • application/x-vnd.oasis.opendocument.text
  • image/png
  • image/jpeg
  • image/jpg

ファイルが見つからない場合は、search_files などの他のツールを使用して、キーワードでユーザーがリクエストしているファイルを検索してみてください。

次のサンプルは、curl を使用して read_file_content MCP ツールを呼び出す方法を示しています。

Curl リクエスト
curl --location 'https://drivemcp.googleapis.com/mcp/v1' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'content-type: application/json' \
--header 'accept: application/json, text/event-stream' \
--data '{
  "method": "tools/call",
  "params": {
    "name": "read_file_content",
    "arguments": {
      // provide these details according to the tool's MCP specification
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}'
                

入力スキーマ

コメントの取得をサポートするファイル コンテンツの読み取りリクエスト。

ReadFileContentRequest

JSON 表現
{
  "fileId": string,
  "includeComments": boolean
}
フィールド
fileId

string

必須。取得するファイルの ID。

includeComments

boolean

レスポンスにコメントを含めるかどうか。コメントは、コメント スレッドへのマッピングとともに、ファイルのテキスト コンテンツにインラインで表示されます。

出力スキーマ

ファイル コンテンツの読み取りに対するレスポンス。

ReadFileContentResponse

JSON 表現
{
  "contentAnchoredComments": [
    {
      object (CommentThread)
    }
  ],
  "unanchoredComments": [
    {
      object (CommentThread)
    }
  ],

  "fileContent": string

  "textFormattingNotSupported": boolean
  // End of list of possible types for union field
  // _text_formatting_not_supported.

  "commentsNotSupported": boolean
}
フィールド
contentAnchoredComments[]

object (CommentThread)

返された file_content で参照されるコメント スレッド。

unanchoredComments[]

object (CommentThread)

返されたファイル内の特定のコンテンツに固定できなかったコメント スレッド。

共用体フィールド _file_content

_file_content は次のいずれかになります。

fileContent

string

テキスト形式で返されるドライブ ファイルのコンテンツ。ファイルのテキスト形式がサポートされていない場合は空になります。リクエストで include_comments が true の場合は、コメント参照を含めることができます。

共用体フィールド _text_formatting_not_supported

_text_formatting_not_supported は次のいずれかになります。

textFormattingNotSupported

boolean

このファイルでテキストの書式設定がサポートされているかどうか。true の場合、file_content は空になります。

共用体フィールド _comments_not_supported

_comments_not_supported は次のいずれかになります。

commentsNotSupported

boolean

このファイルでコメントの返信がサポートされているかどうか。リクエストで include_comments が 正 で、コメントが 対象外 の場合にのみ存在します。

CommentThread

JSON 表現
{
  "replies": [
    {
      object (Post)
    }
  ],

  "commentId": string

  "status": enum (Status)

  "headPost": {
    object (Post)
  }
}
フィールド
replies[]

object (Post)

コメント スレッドの最初の投稿への返信。

共用体フィールド _comment_id

_comment_id は次のいずれかになります。

commentId

string

コメント スレッドの ID。これは最初のコメントと同じ ID です。

共用体フィールド _status

_status は次のいずれかになります。

status

enum (Status)

コメント スレッドのステータス。

共用体フィールド _head_post

_head_post は次のいずれかになります。

headPost

object (Post)

コメント スレッドの最初の投稿。

投稿

JSON 表現
{

  "postId": string

  "content": string

  "authorName": string

  "modifiedTime": string
}
フィールド

共用体フィールド _post_id

_post_id は次のいずれかになります。

postId

string

投稿の ID。

共用体フィールド _content

_content は次のいずれかになります。

content

string

投稿の内容。

共用体フィールド _author_name

_author_name は次のいずれかになります。

authorName

string

投稿の作成者の名前。

共用体フィールド _modified_time

_modified_time は次のいずれかになります。

modifiedTime

string (Timestamp format)

投稿が最後に変更された時刻。

RFC 3339 を使用します。生成された出力は常に Z 正規化され、小数点以下は 0、3、6、または 9 桁になります。「Z」以外のオフセットも使用できます。例: "2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z""2014-10-02T15:01:23+05:30"

タイムスタンプ

JSON 表現
{
  "seconds": string,
  "nanos": integer
}
フィールド
seconds

string (int64 format)

UNIX エポック 1970-01-01T00:00:00Z からの UTC 時刻の秒数を表します。-62135596800~253402300799 の範囲(両端を含む)にする必要があります(これは 0001-01-01T00:00:00Z~9999-12-31T23:59:59Z に対応します)。

nanos

integer

ナノ秒分解能による、秒の負ではない小数以下部分。このフィールドは、秒の代替ではなく、期間のナノ秒部分です。小数以下を含む負の秒の値は、時間を前方にカウントする負ではない nanos 値を持つ必要があります。0 ~ 999,999,999 にする必要があります(両端を含む)。

ステータス

コメント スレッドのステータスを定義します。

列挙型
STATUS_UNSPECIFIED
OPEN
RESOLVED

ツールのアノテーション

破壊的ヒント: ❌ | べき等ヒント: ✅ | 読み取り専用ヒント: ✅ | オープン ワールド ヒント: ❌

認可スコープ

次の OAuth スコープのいずれかが必要です。

  • https://www.googleapis.com/auth/drive
  • https://www.googleapis.com/auth/drive.appdata
  • https://www.googleapis.com/auth/drive.file
  • https://www.googleapis.com/auth/drive.meet.readonly
  • https://www.googleapis.com/auth/drive.metadata
  • https://www.googleapis.com/auth/drive.metadata.readonly
  • https://www.googleapis.com/auth/drive.photos.readonly
  • https://www.googleapis.com/auth/drive.readonly