86 lines
2.1 KiB
Markdown
86 lines
2.1 KiB
Markdown
# ReadUserTemplate
|
|
|
|
Loads a template file from the caller's `templates/` subdir (`data/users/{userId}/templates/`).
|
|
|
|
## Overview
|
|
|
|
Templates are plain Markdown files the user stores in their `templates/` folder via the UI.
|
|
Unlike `memory/` entries, frontmatter is **optional** — a template can be pure Markdown prose
|
|
with no YAML header at all.
|
|
|
|
Use this tool when the user says "use the weekly-report template" or "follow the api-error-email
|
|
boilerplate" — call `ReadUserTemplate`, read the shape, then adapt it to the task at hand.
|
|
|
|
---
|
|
|
|
## Usage
|
|
|
|
```json
|
|
{ "name": "weekly-report" }
|
|
```
|
|
|
|
Or with the `.md` extension (both forms work):
|
|
|
|
```json
|
|
{ "name": "weekly-report.md" }
|
|
```
|
|
|
|
**Response example (no frontmatter):**
|
|
|
|
```
|
|
# Template: weekly-report
|
|
|
|
## Body
|
|
# Weekly Report
|
|
|
|
Fill in this week's highlights here.
|
|
```
|
|
|
|
**Response example (with frontmatter):**
|
|
|
|
```
|
|
# Template: api-error-email
|
|
|
|
## Frontmatter
|
|
title: "API Error Email"
|
|
audience: "external"
|
|
|
|
## Body
|
|
Dear customer,
|
|
|
|
We apologize for the inconvenience.
|
|
```
|
|
|
|
---
|
|
|
|
## Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
|-----------|------|----------|-------------|
|
|
| `name` | string | Yes | Template filename, with or without `.md` extension (max 128 chars) |
|
|
|
|
---
|
|
|
|
## Error cases
|
|
|
|
- Returns an error if the template does not exist in `templates/`.
|
|
- Returns an error if no user is authenticated.
|
|
- Returns an error if `name` contains path traversal characters or slashes.
|
|
|
|
---
|
|
|
|
## Use cases
|
|
|
|
- Weekly / monthly report boilerplate: `ReadUserTemplate({ name: "weekly-report" })` → fill in stats.
|
|
- Email canned responses: `ReadUserTemplate({ name: "api-error-email" })` → personalise and send.
|
|
- Code boilerplate: `ReadUserTemplate({ name: "react-component" })` → generate a new component.
|
|
|
|
---
|
|
|
|
## Related tools
|
|
|
|
- `ListUserAssets({ kind: "templates" })` — see what templates exist before reading one.
|
|
- `ReadUserMemory` — for structured facts/preferences (requires frontmatter).
|
|
- `RunUserScript` — for executable Node/Playwright scripts stored in `scripts/` / `browser-macros/`.
|
|
- This tool is a META_TOOL — no need to add it to `allowed_tools` in piece YAML.
|