Skip to main content

get_resource

Read one resource's full content and metadata by its uri (as shown by list_resources). Text resources come back as plain text; binary ones (images, PDFs, archives) come back base64-encoded — the content_encoding field tells you which. Use it to inspect a resource before editing, or to copy it into a personal or team space the credential can manage.

To search a large text resource without pulling all of it back, use grep_resource instead.

You can read any resource you can see, including one from your organization's shared catalogue. A resource you can't see reads as not found — its existence is never revealed.

Parameters​

ParameterTypeRequiredDescription
uristringYesThe resource to fetch, by the uri list_resources shows.

Response​

FieldTypeDescription
uristringThe resource's address.
namestringThe resource's label.
pathstringThe resource's path.
content_typestringIts MIME type.
size_bytesintegerIts size in bytes.
versionintegerThe current version — pass as expected_version to a guarded edit.
contentstringThe content, encoded as content_encoding says.
content_encodingstringutf8 for text resources, base64 for binary ones.

Example​

{
"uri": "apistash://me/docs/readme.md"
}

Result:

{
"uri": "apistash://me/docs/readme.md",
"name": "readme.md",
"path": "docs/readme.md",
"content_type": "text/markdown",
"size_bytes": 7,
"version": 1,
"content": "# Hello",
"content_encoding": "utf8"
}

Errors​

Each failure carries a precise code in the response. A domain rejection — a not-found or a capability denial — is returned as a tool result with isError: true, so the agent can read the code and self-correct; malformed arguments and server faults are JSON-RPC protocol errors.

CodeCauseDelivered as
resource_not_foundNo such resource is visible to you — it doesn't exist or is out of scope.tool error (isError)
capability_deniedThe credential lacks the Resources capability required for this read.tool error (isError)
invalid_argumentsThe arguments are missing or don't match the input schema.protocol error (invalid_params)
internal_errorAn unexpected error occurred.protocol error (internal_error)

Notes​

  • A successful response contains content, version, and metadata from the same revision. If a concurrent update or deletion makes that revision unavailable during the read, the call can fail with internal_error; read again to obtain a fresh editing basis.
  • When replacing content with update_resource, send the returned version as the required expected_version. You can also pass it to patch_resource to guard an edit against a change since this read.
  • To copy a catalogue resource, read it here, then use create_resource.
  • Reading a resource counts as one tool call against your plan's tool-invocation allowance.