Read a file for a pack tool's call
const url = 'https://example.com/v1/tool-files/example';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://example.com/v1/tool-files/exampleA pack tool that declares readsFiles gets the call’s tool files with each call, and its pack service reads each file the tool asks for here, by its file value’s artifactId. No API key: Authorization: Bearer carries the call’s token (kgi_tf_…). The call reads a file its run may be shown, such as one in the run’s input, in its conversation, or one a tool stored in it, with the bytes it was stored with, never a copy made for a model. A read isn’t refused for a closing or suspended tenant or a suspended project: it changes nothing. The token closes when the call answers, when its time passes, or when its run ends.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The file value’s artifactId.
Responses
Section titled “Responses”The file’s bytes, as it was stored (application/octet-stream, as an attachment, never sniffed); or no bytes, and why, as JSON (notRead).
Why a pack tool’s read of a stored file answered no bytes. The read’s bytes come as application/octet-stream instead.
object
rule (the call’s run may not be shown a file of that id, whether or not the id names a file elsewhere), gone (deleted, or its bytes are missing), changed (its bytes aren’t the ones that were checked), size (over its type’s limit).
Example
{ "notRead": "rule"}tool-file-token-not-found: no tool call’s files match the bearer (none sent, an unknown token, a wrong secret, and a call that doesn’t read files alike), or this runtime stores no files.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}tool-file-token-closed: the call has answered, its time has passed, or its run has ended.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}rate-limit-exceeded: too many requests from this client in a minute, counted before the token is looked up, so nothing was read. Retry-After says when to read the file again.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}tool-files-busy: the runtime’s memory for files had no room for the bytes in time, so nothing was read. database-busy: the database was too busy to answer in time. Retry-After says when to read the file again.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}