Explore Artifact Files
artifact-exploreInspect the files of an EXISTING artifact: list them, search their text, read them, or review the commit history. Works with no shell, no git and no network access, so prefer it whenever you cannot run git. Pass the sessionId (the last path segment of a .../chat/ URL). A canvasDraft field, when authorized, reports an uncommitted Canvas draft. Use action draft to inspect its projection overlay explicitly; ordinary reads remain committed files. Draft access requires write permission. Typical flow to change something: action "search" to find the file, action "read" for the files you will edit, then artifact-edit. Every response includes "revision", the artifact's current commit — pass it back as artifact-edit's baseRevision. Use action "read" with a "revision" to see how a file looked at an earlier commit (this is how you undo something). Assets — images, fonts, media — are readable too: action "read" answers with size, mime and oid under "asset": true whenever a file's bytes are not text, instead of content. That check is on the bytes, so it is the authority: an SVG reads as text, and a file with an unfamiliar extension may still come back as an asset. When a search comes back empty, check "notSearched": "assets" counts binary files a text query can never match, and "excluded" counts files under node_modules, dist or build — re-run with includeExcluded true to search those. A "tree" listing also maps any path artifact-edit cannot change under "unwritable". For generation or build progress use artifact-status instead; this shows the commit log, not build state.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | tree and search only: a literal directory prefix to look inside, e.g. "src" or "packages/ui". NOT a glob — no wildcards. | |
| limit | No | tree, search and history: maximum rows to return (tree ≤500, search ≤500, history ≤50). | |
| paths | No | For read (REQUIRED) or draft (optional; omit to list changed paths): up to 10 file paths to return in one call. The whole response shares a size budget: files past it come back with deferred: true. Every file reports startLine, endLine and totalLines, plus truncated: true when what you got is not the whole file — read the rest with an explicit range. A file whose bytes are not text comes back as asset: true with its size instead of content; committed reads also include mime and oid. | |
| query | No | search only, REQUIRED for it: text to find. Matching never spans lines, and is case-insensitive unless you pass caseSensitive. Each match reports occurrences, the count on that line — sum them when you need the total in a file, since one line can hold several. | |
| range | No | read or draft, optional: line window as "startLine,endLine" (1-based, inclusive), e.g. "1,120". Valid only when paths holds exactly one file. | |
| regex | No | search only: treat query as a JavaScript regular expression instead of literal text. | |
| action | Yes | What to look at. tree = list file paths. search = find text inside files (start here when you do not know which file to change). read = committed file contents. history = commits, newest first. draft = inspect the saved Canvas draft overlay; requires write access. Omit paths to list changed paths, or pass paths and an optional line range to read them. Not a Git revision; unchanged files belong to baseCommitHash. | |
| cursor | No | history only: continue the log after this point, using nextCursor from a previous response. | |
| revision | No | tree, read and search: look at the artifact as it was at this commit instead of now — this is how you recover earlier content. history: return this single commit with the files it changed. Accepts a commit id from action=history, an unambiguous abbreviation of one, or "HEAD"; not a branch name, tag or range. Commits are on main only. | |
| sessionId | Yes | The artifact session id — the last path segment of the artifact URL (e.g. "mr25vsjppVtbMx" from https://app.agentgrid.io/artifacts/mr25vsjppVtbMx), or the id from artifact-create. | |
| caseSensitive | No | search only: match case exactly. Use it before counting occurrences you intend to replace. | |
| includeExcluded | No | tree and search: also include node_modules, dist and build, which are skipped by default. When a search comes back empty with notSearched.excluded set, the term may be in there. |