# Show Document Tool

## Purpose

Use `Show_Document` to preview exactly one GovTribe user file, government file, or GovTribe AI shell artifact in chat. It is read-only by default.

Use annotation mode only when a human needs to mark up a WebViewer-viewable document and send review feedback back to chat.

## Inputs

Provide exactly one document identifier:

* `user_file_id`: GovTribe user file id.
* `external_file_id`: GovTribe government file id.
* `shell_file_identifier`: GovTribe AI shell artifact identifier such as `sandbox:/mnt/data/report.pdf`; only valid inside an active GovTribe AI response context.

Optional fields:

* `query`: text to highlight after load.
* `scroll_to_query`: whether to scroll to the highlighted query.
* `annotations`: optional strict object enabling annotation mode.

## Annotation Mode

Annotation mode is opt-in:

```json
{
  "annotations": {
    "enabled": true,
    "tools": ["highlight", "note", "free_text", "rectangle"],
    "helperText": "Mark up the document, then submit annotations back to chat.",
    "submitLabel": "Submit annotations"
  }
}
```

Supported tools are `highlight`, `note`, `free_text`, and `rectangle`. If `tools` is omitted, all four are enabled.

Annotations do not modify the source file. The widget persists normalized annotation state and WebViewer XFDF through `Interaction_State`, then submits a concise user message summary back to chat.

When submitted annotation comments are phrased as edits, treat them as follow-up instructions. For example, a comment such as "make this say GENERATED" means the user wants a revised document artifact; the annotation state identifies what to change, but a separate document-editing step must create the updated file.

Annotation mode is available only for WebViewer document previews such as PDFs. Inline image previews and unsupported file types remain read-only.

## Output Behavior

Read-only previews do not return an `interactionId`.

Annotation-enabled previews return:

* `interactionId`
* `kind: "document_annotation"`
* `status: "pending"`
* `isInteractive: true`
* `annotationConfig`
* `annotations: []`
* `annotationCount: 0`
* `xfdf: null`

After submission, `Interaction_State` contains normalized annotations:

```json
{
  "annotations": [
    {
      "id": "annotation-1",
      "type": "highlight",
      "pageNumber": 2,
      "text": "Important sentence",
      "comment": "Needs follow-up",
      "color": "#facc15",
      "rects": [
        { "x": 10, "y": 20, "width": 120, "height": 16 }
      ]
    }
  ],
  "annotationCount": 1,
  "status": "submitted",
  "isInteractive": false
}
```

## Examples

Read-only preview:

```json
{
  "user_file_id": "USER_FILE_ID"
}
```

Search-highlighted preview:

```json
{
  "external_file_id": "EXTERNAL_FILE_ID",
  "query": "Section L",
  "scroll_to_query": true
}
```

Annotation-enabled PDF review:

```json
{
  "user_file_id": "USER_FILE_ID",
  "annotations": {
    "enabled": true,
    "tools": ["highlight", "note", "rectangle"],
    "helperText": "Mark the clauses that need follow-up.",
    "submitLabel": "Send review notes"
  }
}
```

## Routing Guidance

Use document search or vector-store tools when the task is extracting text, searching clauses, summarizing document content, or doing semantic review.

Use `Show_Document` annotation mode when the user needs to visually inspect a document and provide human markup or comments.

If submitted comments request document changes, use the appropriate document artifact workflow to revise the file and show or return the updated document.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.govtribe.com/user-guide/mcp/tools/show-document.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
