decocms
resource_read
Read a resource from the current scope
Overview
Reads a resource from the current scope. Supports scope inheritance (project inherits from org, agent inherits from project+org). Resources can be documentation, guidelines, code snippets, or any contextual information.
Availability
- Tasks: ✓ Available
- Subtasks: ✓ Available
Signature
resource_read(
resource_uri: string,
options?: RangeOptions
)
type RangeOptions = {
lineStart?: number
lineEnd?: number
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
resource_uri | string | Required | URI identifier for the resource |
options | RangeOptions | Optional | Line range options |
options.lineStart | number | Optional | Starting line number (default: 0) |
options.lineEnd | number | Optional | Ending line number (default: 20) |
Returns
Resource content and metadata:
- content: The resource text content
- uri: Resource URI
- metadata: Additional resource information
Behavior
- Supports scope inheritance:
- Project resources inherit from organization resources
- Agent resources inherit from project + organization resources
- Set both
options.lineStartandoptions.lineEndto 0 to read entire resource - Default behavior (no options) reads first 20 lines (lines 0-20)
- Line numbers are zero-indexed
Example Usage
Read Entire Resource
// Read entire coding guidelines document
resource_read("coding-guidelines.md", { lineStart: 0, lineEnd: 0 })
Read Specific Lines
// Read lines 10-30 of API documentation
resource_read("api-docs.md", { lineStart: 10, lineEnd: 30 })
Read Beginning of Resource
// Read first 20 lines (default)
resource_read("onboarding-guide.md")
Resource Types
// Read coding standards
resource_read("standards/typescript-style.md", { lineStart: 0, lineEnd: 0 })
// Read deployment procedures
resource_read("procedures/deployment-checklist.md", { lineStart: 0, lineEnd: 0 })
// Read API documentation
resource_read("docs/rest-api-reference.md", { lineStart: 0, lineEnd: 0 })
Use Cases
Context-Driven Execution
Read guidelines before executing work:
// Read coding standards
const standards = resource_read("coding-standards.md", { lineStart: 0, lineEnd: 0 })
// Apply standards when generating code
// ... code generation logic
Documentation Reference
Access reference documentation during task:
// Read API docs
const apiDocs = resource_read("api-reference.md", { lineStart: 0, lineEnd: 0 })
// Use docs to make correct API calls
// ... API call logic
Procedure Compliance
Follow documented procedures:
// Read deployment checklist
const checklist = resource_read("deployment-checklist.md", { lineStart: 0, lineEnd: 0 })
// Follow each step in the checklist
// ... deployment logic
Scope Inheritance
Resources follow scope hierarchy:
- Agent scope: Inherits from project + organization
- Project scope: Inherits from organization
- Organization scope: Base level resources
When reading a resource, the system searches from most specific (agent) to least specific (organization) scope.
Related
- prompt_read - Read prompt templates
- Context Documentation
- Built-in Tools Overview
Found an error or want to improve this page?
Edit this page