create_doc_from_file
Turn a local .md or .html file into a Google Doc, parsing Markdown features and embedding referenced images inline.
Instructions
Create a Google Doc from a local .md or .html file. Not available when the server runs with LOCAL_FILE_ACCESS=off.
The file format is inferred from the extension: .md files are parsed as Markdown, .html / .htm files as HTML. The document title defaults to the filename without extension if not supplied.
Images referenced from the file (markdown "" or HTML )
are embedded inline the same way create_doc's own content_format='markdown'
path handles them — see that tool's docstring for the src conventions, the
revoke_sharing tradeoff, the auto_downscale size-limit behavior, and the
alt-text fallback. A relative local image path is relative to the file's own
folder, as in a README.
For .md files specifically, upload_local_file(convert=True) is a Drive-native alternative: one API call using Drive's own import converter, versus this tool's local parse-and-rebuild pipeline. This tool supports more Markdown features (tables, nested lists, task items, fenced code blocks, inline images) at the cost of more Docs API calls; Drive's importer is a single call but its fidelity is whatever Drive's own converter does.
Args: local_path: Absolute or relative path to the local file. title: Document title. Defaults to the filename stem. folder_id: Optional Google Drive folder ID for the doc and its local images. Defaults to the server's default folder, else the root of My Drive. autolink_urls: For .md files, whether a bare http(s):// URL, www. address or email address becomes a real hyperlink (default True). Set False to leave them as plain text; to suppress just one, wrap it in backticks instead. No effect on .html files. revoke_sharing: Whether a local-path/drive: image's temporary anyone:reader share is revoked again after it's embedded (default True). An image file that was already link-shared before the call keeps its link and is reported with already_shared: true. auto_downscale: Resize an oversized local-path/drive: image instead of failing it (default False) — see create_doc's own docstring.
Returns: Information about the newly created document including its ID and web link. Includes "images" (per-image outcomes) when the file contained any images. Includes "dropped_links" when a link was written as plain text instead (see create_doc). If the content can't be converted, returns {"error"} and creates no doc. If writing the content fails after the doc was created, returns {"error", "docId", "images", "dropped_links"} instead, with any temporary image share already revoked.
Note: Requires OAuth or ADC auth. Service accounts cannot create files in personal Drive (no storage quota). Check server://auth-status for your current auth method.
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": {
"local_path": "<local_path>"
},
"name": "create_doc_from_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | ||
| folder_id | No | ||
| local_path | Yes | ||
| autolink_urls | No | ||
| auto_downscale | No | ||
| revoke_sharing | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||