get_document
Get the full text of a document by supplying its filename. If the exact filename is unknown, call list_documents first.
Instructions
Retrieve the full text of a document by filename. Call list_documents first if you're unsure of the exact filename.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"filename": "<filename>"
},
"name": "get_document"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- server/main.py:59-65 (handler)The MCP tool handler for 'get_document'. It is decorated with @mcp.tool() and delegates to _index.get_document(filename).
@mcp.tool() def get_document(filename: str) -> str: """ Retrieve the full text of a document by filename. Call list_documents first if you're unsure of the exact filename. """ return _index.get_document(filename) - server/main.py:59-59 (registration)The @mcp.tool() decorator on the get_document function registers it as an MCP tool with the FastMCP server instance.
@mcp.tool() - server/search.py:114-118 (helper)The DocumentIndex.get_document() method that retrieves the full text of a document by filename from the in-memory index, or returns an error message if not found.
def get_document(self, filename: str) -> str: if filename not in self.documents: available = ", ".join(sorted(self.documents)) or "none" return f"Document '{filename}' not found. Available: {available}" return self.documents[filename]