get_attachments
MyDART MCP의 get_attachments 도구는 공시의 첨부파일 목록과 형제문서 본문·페이지 이미지를 다룹니다.
[Purpose]
Attachment list + 형제문서 routing; body text = mode=text (뷰어 원문), 구조 보존은 download_document.
자금부정통제 붙임·경영진 운영실태보고서 live here (mode=text; 붙임 = attachment_links[].retrieve).
Scan-only (도장·서명·스캔 서식): mode=images only.
[Usage]
정관·영업보고서 본문 → list 로 dcm_no 확보 → dcm_no, mode="text"
표가 이미지뿐이면 mode="images" (뒷장 image_from, PDF 페이지 pages)
[Response]
format: hwpx/hwp/pdf/docx/doc/xlsx/xls/zip/html/unknown
images: source="viewer" or "pdf" — different field shapes.
[Rules]
supported:false → unsupported_reason·suggestion·note·retrieve·next_step = the fallback route; follow it verbatim.
No bulk sweeps — mass viewer calls bring DART IP bans.
Ladder: text (표 lossless) → empty·링크 껍데기 body → images → download_url. Attachment files are never parsed server-side.
images returns pictures: OCR·판독 is the client's job, 1 image per capped call (image_from).
partial:true ⇒ section_errors[]; markdown is partial — 빈 곳 ≠ 사실 없음.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | list: the attachment list only — nothing is downloaded, so it is the cheap call. text: the document body as 마크다운 via the 뷰어 원문 (XML→HTML) path — it skips PDF conversion, so text and tables are lossless and it is hundreds of times lighter. The primary path for sibling documents (정관·영업보고서·운영보고서 etc.) and the route to take whenever body text is what you want. images: return embedded images (도장·스캔본·차트 and other raster that text cannot capture). With NO filename/index it takes the 뷰어 원본 JPEG route (manifest.source="viewer": originals in document order, per-section eleId); with filename or index it scans THAT attachment PDF instead (source="pdf": decoded PNGs, largest area first, with page numbers; pages narrows it). The two routes return different field shapes. There is no file-parsing mode: an attachment file itself is reached through download_url, never parsed server-side. | list |
| index | No | 0-based index of the attachment to scan, in images mode (filename takes precedence). Like filename it picks the PDF-scan route; omit both to get the 뷰어 임베드 원본 JPEG. | |
| pages | No | Page filter for images mode (1-based, PDF-scan path only). e.g. "3", "1-5", "2,4,7-9". It narrows pages WITHIN the attachment picked by filename/index, so it requires one of them. Unset on a filename/index call = a scan of only that PDF's FIRST 40 pages. At most 2000 pages per call — a wider span is rejected, not silently trimmed. | |
| dcm_no | No | Target 문서번호(dcmNo). Defaults to the 본문 document. One 공시(rcept_no) carries, besides the 본문, sibling documents (감사보고서·내부회계관리제도운영보고서·영업보고서·정관 etc.) each with its own dcmNo; take sibling_documents[].dcm_no from a list result to read that document (list its attachments, or mode=text/images). A sibling's attachments are invisible without it — always list first, then pass sibling_documents[].dcm_no. | |
| filename | No | Exact filename of the attachment to scan, in images mode (no partial-match fallback). Giving it PICKS the PDF-scan route — omit both filename and index to get the document's 뷰어 임베드 원본 JPEG instead. An EXACT match is required; on failure the error lists the available names. | |
| rcept_no | Yes | 14-digit 접수번호 (separators are stripped automatically) | |
| sections | No | Which sections to fetch, in mode="text" — the **sections[] array index** (0-based). NOT the eleId: in these documents eleId runs "1".."8", so eleId happens to equal index+1 and is easy to confuse. e.g. to read the 3rd and 6th entries of sections[], pass [2, 5]. Unset = the previous behavior (the first 24 sections, all fetched). [] = 목차 only — zero body calls, sections[] carries just the titles (md_chars all 0); read them, then call again with the indices you want (2-pass). The pick happens BEFORE the 24-node ceiling, so it reaches sections 25~158 of a 사업보고서 본문 that are otherwise unreachable at any truncate_at. Max 24 picks; out-of-range indices are dropped with a note in `notes` (all-out-of-range is rejected). In this mode every sections[] entry carries its own index — check it against what you asked for (an off-by-one that stays in range otherwise returns a neighbouring section silently). | |
| image_from | No | Start offset in document order for the 뷰어 원본 JPEG route (0-based, default 0). Channels with a response cap fit only ~1 scan page per call, so this is how you reach later pages — e.g. the 자금부정통제 표 is usually the 2nd page of an 운영실태보고서, so image_from=1. The response carries `from` and a note telling you the next offset. PDF-scan route uses pages instead. | |
| max_images | No | Max images returned in images mode (largest area first). Default 12. | |
| truncate_at | No | Max length of the mode=text 마크다운 (default 100,000 chars; out-of-range values are clamped to the bound) | |
| min_dimension | No | In images mode, an image whose shorter side is under this many pixels is treated as decoration (아이콘·괘선) and dropped. Default 24. Lower it to catch small 도장/서명. It filters the PDF-scan path only (source:"pdf") — 뷰어 원본 JPEG images pass through unfiltered. |