You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8b06771
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/guide/agent-native.md
+47-1Lines changed: 47 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Three building blocks:
16
16
17
17
1.**An `agent` field on `defineRpcFunction`.** Add `agent: { description, ... }` to opt a function in. Functions without the field stay private.
18
18
2.**`ctx.agent`** — a host exposed on `DevframeNodeContext`. Plugins register tools that aren't backed by an RPC, and expose readable resources (e.g. a Markdown build summary).
19
-
3.**The MCP adapter** (`devframe/adapters/mcp`) — translates the agent host into a [Model Context Protocol](https://modelcontextprotocol.io) server, currently over `stdio`.
19
+
3.**The MCP adapter** (`devframe/adapters/mcp`) — translates the agent host into a [Model Context Protocol](https://modelcontextprotocol.io) server, over `stdio` (`devframe mcp`) or as a Streamable-HTTP route on the dev server (`--mcp`, advertised in `__connection.json`).
20
20
21
21
## Exposing an RPC function
22
22
@@ -118,6 +118,52 @@ Add an entry to `claude_desktop_config.json`:
118
118
119
119
Restart Claude Desktop. The tools you flagged with `agent: { ... }` (plus any `registerTool` calls) show up in the MCP tool drawer. Resources are reachable as `devframe://resource/<id>` and `devframe://state/<key>` URIs.
120
120
121
+
## Writing descriptions agents act on
122
+
123
+
A tool description is a prompt, not documentation. The agent decides *when* to call your tool from the description alone, so tell it — state when to reach for the tool, not just what it returns:
124
+
125
+
<!-- eslint-skip -->
126
+
127
+
```ts
128
+
// ✗ Bad: describes the mechanism
129
+
agent: { description: 'Returns the session summary object.' }
130
+
// ✓ Good: tells the agent when and why
131
+
agent: { description: 'Summarize the current build session — durations, chunk counts, warnings. Call this before proposing any build-config change.' }
132
+
```
133
+
134
+
Two conventions:
135
+
136
+
-**Lead with the action and the trigger.** "Call this before/after/when …" steers proactive use; a bare noun phrase gets ignored.
137
+
-**State freshness and cost.** "Safe to call freely" / "expensive, call once per session" lets the agent budget calls.
138
+
139
+
## Gateway tools
140
+
141
+
A gateway tool returns *instructions and locations* instead of doing the work — the pattern for anything the agent can do better directly (reading bundled docs, running a CLI it has shell access to):
142
+
143
+
```ts
144
+
ctx.agent.registerTool({
145
+
id: 'my-plugin:docs',
146
+
description: 'Locate the version-accurate docs for this tool. Call before answering questions about its config format.',
147
+
safety: 'read',
148
+
handler: () => ({
149
+
docsPath: resolveInstalledDocsDir(),
150
+
hint: 'Read the file matching your topic; do not rely on training-data knowledge of this config format.',
151
+
}),
152
+
})
153
+
```
154
+
155
+
The agent gets a path and a next step; the actual reading happens with its own tools, which are faster and keep large content out of the MCP payload.
156
+
157
+
## Structured errors
158
+
159
+
A coded devframe diagnostic thrown from a tool handler crosses the MCP boundary as structured JSON rather than a flattened message:
Copy file name to clipboardExpand all lines: examples/a11y-messages-playground/package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
{
2
2
"name": "a11y-messages-playground",
3
3
"type": "module",
4
-
"version": "0.7.14",
4
+
"version": "0.7.15",
5
5
"private": true,
6
6
"description": "A focused hub playground that pairs @devframes/plugin-a11y with @devframes/plugin-messages over an intentionally-broken, multi-route app under test — for exercising a11y scanning, route tracking, and message→dock navigation.",
Copy file name to clipboardExpand all lines: examples/json-render/package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
{
2
2
"name": "json-render",
3
3
"type": "module",
4
-
"version": "0.7.14",
4
+
"version": "0.7.15",
5
5
"private": true,
6
6
"description": "Standalone devframe that serves a JSON-render view — a server-authored spec rendered by @devframes/json-render-ui, with live state and an action bridge.",
Copy file name to clipboardExpand all lines: examples/streaming-chat/package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
{
2
2
"name": "streaming-chat-example",
3
3
"type": "module",
4
-
"version": "0.7.14",
4
+
"version": "0.7.15",
5
5
"private": true,
6
6
"description": "End-to-end devframe demo — streams synthetic chat tokens from server to client via `ctx.rpc.streaming`. Mirrors the AI-deltas use case from issue #306.",
0 commit comments