textrawl
byJeff Green

get_document

Retrieve full document content by ID

Retrieve the complete content of a document, optionally including its chunks.

Parameters

ParameterTypeRequiredDefaultDescription
documentIdstringREQUIRED-UUID of the document
includeChunksbooleanOPTIONALfalseInclude document chunks
maxContentLengthnumberOPTIONAL4000Maximum content characters to return (0 = full content)

Example Request

{
  "documentId": "550e8400-e29b-41d4-a716-446655440000",
  "includeChunks": true
}

Response

The MCP response contains both content (text for LLM consumption) and structuredContent (canonical JSON):

{
  "content": [{ "type": "text", "text": "{...}" }],
  "structuredContent": {
    "document": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "title": "Q4 Planning Notes",
      "sourceType": "note",
      "sourceUrl": null,
      "content": "Full document content...",
      "metadata": { "tags": ["work", "planning", "q4"] },
      "createdAt": "2024-10-15T14:30:00Z",
      "updatedAt": "2024-10-15T14:30:00Z"
    },
    "chunks": [
      {
        "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
        "index": 0,
        "content": "First chunk content..."
      },
      {
        "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
        "index": 1,
        "content": "Second chunk content..."
      }
    ]
  }
}

Output Schema

This tool MUST return structuredContent alongside the text response. The structuredContent object MUST use canonical verbose keys regardless of the COMPACT_RESPONSES setting.

FieldTypeDescription
documentobjectThe document
document.idstringDocument UUID
document.titlestringDocument title
document.sourceTypestringSource type (note, file, url)
document.sourceUrlstring?Source URL (null if not applicable)
document.contentstringDocument content (may be truncated)
document.truncatedbooleanWhether content was truncated
document.fullLengthintegerFull content length (when truncated)
document.metadataobject?Document metadata
document.metadata.tagsstring[]Document tags (within metadata)
document.createdAtstringISO creation timestamp
document.updatedAtstringISO update timestamp
chunksarrayDocument chunks (when includeChunks=true)
chunks[].idstringChunk UUID
chunks[].indexintegerChunk index
chunks[].contentstringChunk content

Use Cases

Full Context Retrieval

After searching, get the complete document for context:

1. search returns chunk with documentId
2. get_document(documentId) returns full content
3. Use full content for comprehensive answers

Document Inspection

View all chunks for debugging:

{
  "documentId": "...",
  "includeChunks": true
}

Error Responses

Document not found

{
  "error": "Document not found",
  "message": "No document with ID '550e8400-e29b-41d4-a716-446655440000'"
}

On this page