Browse documentation

get_file_contents

[analysis]

Read a bounded UTF-8 file window.

Unreleased read-only preview. Technical reference for agents and client integrators.

Before this call

Files must stay beneath the workspace without links. Text must be UTF-8 without NUL. An unindexed Java file requires coverage inspection and sync.

Parameters

NameTypeRequiredDescription
pathstringYesContained workspace file path. Use a nonblank string of at most 4096 characters.
startLinenumberNoOne-based integer line, from 1 to 2147483647. Default: 1
lineCountnumberNoInteger from 1 to 1000. Default: 200

Examples

Technical examples for agents and client integrators. Replace paths and opaque keys with returned workspace values.

Illustrative arguments

Arguments
{
  "path": "src/main/java/example/OrderService.java",
  "startLine": 1,
  "lineCount": 80
}
Full MCP request
Full MCP request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_file_contents",
    "arguments": {
      "path": "src/main/java/example/OrderService.java",
      "startLine": 1,
      "lineCount": 80
    }
  }
}

Response notes

Reports text, contentVersion, span, readMode, windowTruncated, and outputTruncated. Java reads use snapshot text after a stale-file check. Other text reads use current_file. A UTF-8 BOM remains in text. Use smaller windows when output is truncated.