Skip to main content
Glama

read_file

Read files from shared folders by specifying the file path, automatically resolving document IDs for access to content and metadata.

Instructions

Read a file from a folder share by its path.

Resolves path -> doc_id automatically. This is the recommended way to read files from folder shares.

Args: share_id: UUID of the folder share. file_path: File path within the folder (e.g. "Marketing/plan.md").

Returns: JSON with doc_id, content, format, path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
share_idYes
file_pathYes

Implementation Reference

  • The read_file tool handler implementation - reads a file from a folder share by resolving its path to a doc_id, then retrieving the content via the Relay Control Plane API.
    @mcp.tool() def read_file(share_id: str, file_path: str) -> str: """Read a file from a folder share by its path. Resolves path -> doc_id automatically. This is the recommended way to read files from folder shares. Args: share_id: UUID of the folder share. file_path: File path within the folder (e.g. "Marketing/plan.md"). Returns: JSON with doc_id, content, format, path. """ import json # Step 1: resolve path -> doc_id with _get_client() as client: r = client.get( f"{_get_base_url()}/v1/documents/{share_id}/files", headers=_headers(), params={"share_id": share_id}, ) r.raise_for_status() files_data = r.json() files = files_data.get("files", {}) file_meta = files.get(file_path) if not file_meta: available = list(files.keys())[:20] return json.dumps( {"error": f"File not found: {file_path}", "available_files": available} ) doc_id = file_meta.get("id") or file_meta.get("doc_id") if not doc_id: return json.dumps({"error": f"No doc_id for file: {file_path}"}) # Step 2: read content with _get_client() as client: r = client.get( f"{_get_base_url()}/v1/documents/{doc_id}/content", headers=_headers(), params={"share_id": share_id, "key": "contents"}, ) r.raise_for_status() content_data = r.json() content_data["path"] = file_path return json.dumps(content_data)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/entire-vc/evc-team-relay-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server