upload_attachment
Attach a local file from the MCP server's disk to a Zephyr Scale test case, test run, test result, or step, using the target key or ID.
Instructions
Attach a local file to a test case, test run (cycle), test result, or to one step of a case or result (POST multipart/form-data /testcase/{key}[/step/{i}]/attachments, /testrun/{key}/attachments, /testresult/{id}[/step/{i}]/attachments). Addressing: 'test_case' needs testCaseKey, 'test_run' needs testRunKey, 'test_result' needs testResultId (numeric); an identifier that does not match the target is rejected. stepIndex is accepted for 'test_case' and 'test_result' only — API v1 has no per-step attachments endpoint for runs. filePath is read from the disk of the machine running this MCP server, not from the caller. Uploads are not idempotent: calling twice creates two attachments. A bogus testResultId is rejected here with 404 even though list_attachments answers [] for it (verified live). Returns the attachment metadata the API reports — on the reference build always a bare { id }, with neither the file name nor the size echoed back, so verifying an upload costs a list_attachments call — or { uploaded: true, fileName, size } when the API answers with an empty body.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | Entity family the attachment belongs to; it decides which identifier is required | |
| fileName | No | File name to store in Zephyr Scale, extension included; defaults to the basename of filePath. Stored verbatim, Unicode and spaces included — except that the API strips any directory prefix, so "../dir/report.png" is stored as "report.png". | |
| filePath | Yes | Path of the file to read and upload, on the machine running this MCP server (absolute path recommended) | |
| stepIndex | No | 0-based index of a single step, instead of the whole entity (targets 'test_case' and 'test_result' only) | |
| testRunKey | No | Test run (cycle) key, e.g. PROJ-R123 (PROJ-C123 on older instances) — required when target is 'test_run' | |
| testCaseKey | No | Test case key, e.g. PROJ-T123 — required when target is 'test_case' | |
| testResultId | No | Numeric test result (execution) id — an id, NOT a key; returned by create_test_result, update_last_test_result and get_test_run_results — required when target is 'test_result' |