home / skills / bdambrosio / cognitive_workbench / fs-read
This skill reads text, JSON, or PDF files from the filesystem sandbox and returns a structured Note with content and metadata.
npx playbooks add skill bdambrosio/cognitive_workbench --skill fs-readReview the files below or copy the command above to add this skill to your agents.
---
name: fs-read
type: python
description: "Read a text, JSON, or PDF file under scenarios/<world_name>/fs and return a Note."
schema_hint: {"path": "string (relative)", "max_chars": "int", "as_json": "bool", "grobid_url": "string"}
---
# fs-read
Read a file from the filesystem sandbox and return its content as a Note. Supports text, JSON, and PDF files.
## Input
- `path`: Relative path under `scenarios/<world_name>/fs` (required)
- `max_chars`: Optional maximum characters to read (text and PDF files only)
- `as_json`: Force JSON parse (default: false, text files only)
- `grobid_url`: Optional GROBID server URL for enhanced PDF parsing (from world_config)
## File Types
- **Text files**: Read as plain text
- **JSON files**: Parsed and returned as structured data
- **PDF files**: Extracted using GROBID (if `grobid_url` provided) or pymupdf fallback. Returns text with PDF metadata (title, author, page count, etc.)
## Output
Success returns:
- `resource_id`: Note ID containing structured content and metadata
## Examples
```json
{"type":"fs-read","path":"notes/todo.txt","out":"$todo"}
{"type":"fs-read","path":"data/config.json","as_json":true,"out":"$config"}
{"type":"fs-read","path":"papers/article.pdf","out":"$paper"}
{"type":"fs-read","path":"papers/article.pdf","max_chars":5000,"out":"$paper_preview"}
```
This skill reads a file from the sandboxed filesystem under scenarios/<world_name>/fs and returns its content as a Note. It supports plain text, JSON, and PDF files and can optionally limit the read size or parse JSON. PDF extraction uses GROBID when available or a pymupdf fallback and includes basic PDF metadata in the result.
You provide a relative path under scenarios/<world_name>/fs and optional parameters: max_chars to limit text/PDF output, as_json to force JSON parsing of text files, and grobid_url to enable enhanced PDF extraction. The skill detects file type, parses JSON into structured data, extracts text from PDFs with metadata, or returns raw text. On success it creates and returns a Note resource ID containing the content and metadata.
What file types are supported?
Plain text, JSON, and PDF files are supported. JSON files are parsed into structured data.
How do I limit the size of returned text?
Use the max_chars parameter for text and PDF extraction to limit the number of characters returned.
When should I provide grobid_url?
Provide grobid_url in world_config when you have access to a GROBID server for better PDF parsing; otherwise the skill uses pymupdf as a fallback.