document_save_to_file
Save the active EasyEDA document's source to a local file, enabling raw edits, batch changes, or backups. Re-upload the modified file with document_load_from_file.
Instructions
Save the source code of the currently active document to a local file. Fetches the document source from EasyEDA and writes it directly to disk. The file will contain the document in EasyEDA's internal format (on EasyEDA Pro 3, one {header}||{body} line per record; the src/lib editing library cannot read this, so use project_export_file for library edits). Use document_load_from_file to push a modified file back.
For schematic and PCB documents, the source is also run through the schema validator in warn mode — the returned JSON includes a validation report, and any unknown tags are logged to ~/.easyeda-schema-discovery.jsonl. Since this is a download (EasyEDA's output), a schema mismatch means our schema is missing coverage, not that the data is bad.
FAST-BATCH WORKFLOW: for making many changes at once, it is much faster to export the document or project (document_save_to_file / project_export_file), edit the raw source on disk, then re-upload (document_load_from_file / project_import_file) than to issue many small per-primitive MCP calls. Formats differ: on EasyEDA Pro 3, document_save_to_file returns {header}||{body} lines, while the .epro from project_export_file holds newline-delimited JSON arrays, which is what the src/lib editing library reads. Every destructive upload is auto-backed-up to a local git repo first — the response includes a backup SHA you can use to find the prior state if the edit goes wrong. Upload tools accept validate='off'|'warn'|'strict' (default 'strict') which runs the Zod schema on the new source — see document_validate for standalone validation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document | Yes | Target document UUID — auto-switches to this document before executing. Get UUIDs from list_instances or editor_get_open_tabs. | |
| filePath | Yes | Absolute path to write the document source to | |
| instance_id | No | Target EasyEDA instance ID (8-char hex). Required when multiple instances are connected. Omit when only one instance is connected (auto-selected). Use list_instances to see connected instances. |