Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tool-docs-mcp-skills-authoring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@agentproto/runtime": patch
---

Document the imported MCP, MCP Apps host, imported skill and tool authoring tool families for the generated skill reference, and remove those tools from the undocumented legacy list.
8 changes: 8 additions & 0 deletions packages/runtime/src/tool-docs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ import { sessionArtifactsToolDoc } from "./session-artifacts.js"
import { sessionControlToolDoc } from "./session-control.js"
import { sessionFollowsToolDoc } from "./session-follows.js"
import { sessionObserveToolDoc } from "./session-observe.js"
import { mcpAppsToolDoc } from "./mcp-apps.js"
import { mcpImportToolDoc } from "./mcp-import.js"
import { skillImportToolDoc } from "./skill-import.js"
import { toolAuthoringToolDoc } from "./tool-authoring.js"
import type { ToolFamilyDoc } from "./types.js"
import { worktreeToolDoc } from "./worktree.js"

Expand Down Expand Up @@ -70,6 +74,10 @@ export const TOOL_FAMILY_DOCS: readonly ToolFamilyDoc[] = [
appToolDoc,
appDataToolDoc,
appUiToolDoc,
mcpAppsToolDoc,
mcpImportToolDoc,
skillImportToolDoc,
toolAuthoringToolDoc,
accountHealthToolDoc,
accountSlotsToolDoc,
branchGcToolDoc,
Expand Down
18 changes: 0 additions & 18 deletions packages/runtime/src/tool-docs/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ export const LEGACY_UNDOCUMENTED_TOOLS: readonly DaemonToolName[] = [
"conversation_export",
"conversation_locate",
"conversation_read",
"create_agent",
"create_tool",
"created_tool_call",
"daemon_health",
"decision_collect_evidence",
"decision_decide",
Expand All @@ -46,7 +43,6 @@ export const LEGACY_UNDOCUMENTED_TOOLS: readonly DaemonToolName[] = [
"decision_stage_escalate",
"decision_stage_rules",
"decision_validate_verdict",
"delete_tool",
"directory_create",
"directory_list",
"fetch_page",
Expand All @@ -67,16 +63,6 @@ export const LEGACY_UNDOCUMENTED_TOOLS: readonly DaemonToolName[] = [
"llm_endpoint_start",
"llm_endpoint_status",
"llm_endpoint_stop",
"mcp_app_tool_call",
"mcp_app_ui_index",
"mcp_app_ui_read",
"mcp_discovered_list",
"mcp_import",
"mcp_imported_call",
"mcp_imported_list",
"mcp_imported_remove",
"mcp_imported_status",
"mcp_imported_tool_list",
"reach_send",
"remote_disable",
"remote_enable",
Expand All @@ -90,10 +76,6 @@ export const LEGACY_UNDOCUMENTED_TOOLS: readonly DaemonToolName[] = [
"sandbox_gc",
"sandbox_list",
"self_inspect",
"skill_import",
"skill_imported_list",
"skill_imported_remove",
"skill_resync",
"telegram_bot_set_webhook",
"telegram_bot_token_set",
"telegram_bot_token_status",
Expand Down
50 changes: 50 additions & 0 deletions packages/runtime/src/tool-docs/mcp-apps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { defineToolFamilyDoc } from "./types.js"

/**
* Sources: `mcp-app-host-tools.ts` (the three tools), `mcp-apps-host.ts`
* (resolution, caching), `tool-profiles.ts` (profiles).
*/
export const mcpAppsToolDoc = defineToolFamilyDoc({
family: "mcp-apps",
title: "MCP Apps host (UI of other MCP servers)",
summary:
"Host the interactive UI an MCP server ships: find which of its tools declare a `ui://` view, read the view, and relay the view's own tool calls.",
whenToUse: [
"A session used an MCP server whose tools declare a UI and a client needs to render it.",
"A rendered MCP App iframe asks to call a tool of its server.",
],
workflow: [
"Call `mcp_app_ui_index {sessionId, server}` with the server name as the harness shows it (`acme` in `mcp__acme__...`); read `tools[]` for `resourceUri` values.",
"Call `mcp_app_ui_read` with one of those `resourceUri` values to get the HTML and its `csp` and `permissions`.",
"When the iframe calls a tool, forward it with `mcp_app_tool_call`, passing the `originToolCallId` of the card that hosts the iframe.",
],
cliCommands: [],
seeAlso: ["mcp-import", "ap-apps"],
tools: {
mcp_app_ui_index: {
effect: "read",
examples: [{ label: "Find the UI tools of a server", args: { sessionId: "sess_example", server: "acme" }, outcome: "Returns `{server, status, tools, appOnlyTools, allToolNames, notAppVisibleTools}`; `status` is `ok`, `unresolved`, `unreachable` or `auth_required`." }],
returns: "`tools[]` with their `resourceUri`, and `status`.",
pitfalls: [
"The server is looked up in the session's scope in this order: session config, project, user, imports.",
"The result is cached; a failure is retried at most once a minute, and failures are reported in-band (`status`, `error`), never as a tool error.",
],
},
mcp_app_ui_read: {
effect: "read",
examples: [{ label: "Read one view", args: { sessionId: "sess_example", server: "acme", resourceUri: "ui://acme/dashboard" }, outcome: "Returns `{resourceUri, html, mimeType, csp?, permissions?, prefersBorder?, domain?}`." }],
returns: "`html` and the `csp` and `permissions` the iframe must be sandboxed with.",
pitfalls: ["Only a `resourceUri` that `mcp_app_ui_index` returned for that server is accepted; anything else comes back as `{error, status}`."],
},
mcp_app_tool_call: {
effect: "external",
examples: [{ label: "Relay an iframe's tool call", args: { sessionId: "sess_example", server: "acme", tool: "refresh_data", args: { id: 1 }, originToolCallId: "toolu_example" }, outcome: "Returns the upstream result verbatim; the call is recorded on the session as `mcp_app_tool_call`." }],
returns: "The upstream `CallToolResult`, or `{isError: true, content}` when refused.",
pitfalls: [
"It is for calls made by the UI, not by the model.",
"`tool` must be visible to apps (`_meta.ui.visibility` does not exclude `app`; the default is model and app) or be the tool whose card hosts the iframe; `tool` is the server's own name, not namespaced.",
"Like `mcp_imported_call`, it has no per-call permission check beyond that visibility rule.",
],
},
},
})
108 changes: 108 additions & 0 deletions packages/runtime/src/tool-docs/mcp-import.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import { defineToolFamilyDoc } from "./types.js"

/**
* Sources: `session-tools.ts` (all seven tools), `mcp-imports.ts` (allow-list),
* `tool-profiles.ts` (profiles), `commands/mcp.ts` in the CLI (verbs).
*/
export const mcpImportToolDoc = defineToolFamilyDoc({
family: "mcp-import",
title: "Imported MCP servers",
summary:
"Find MCP servers already configured in other agent tools, import the ones the user wants into the daemon, then list their tools and call them through the daemon.",
whenToUse: [
"The user has an MCP server set up in another tool (claude-code, cursor, goose) and you want to use it without asking them to configure it again.",
"List, call or remove the MCP servers the daemon already imported.",
"Check which imported servers are connected and how many tools each exposes.",
],
workflow: [
"Call `mcp_discovered_list` and pick an entry; its `id` is the `sourceMcpId`.",
"After the user agrees, call `mcp_import {sourceMcpId}`; the import is keyed by that id and has an `alias`.",
"Call `mcp_imported_tool_list {alias, full: true}` to read each tool's `inputSchema`, then `mcp_imported_call {alias, toolName, args}`.",
"Check the connection with `mcp_imported_status`; remove with `mcp_imported_remove {id}`.",
],
cliCommands: [
{
verb: "mcp",
command: "agentproto mcp mount-default claude-code <importId>",
note: "Makes every future spawn of that adapter mount the given imports natively, with their own tool names. No MCP tool.",
},
{
verb: "mcp",
command: "agentproto mcp migrate-secrets",
note: "Dry run by default: moves header and env secrets of imports into the keychain (`--apply` to do it). No MCP tool.",
},
],
seeAlso: ["mcp-apps", "skill-import", "ap-import-mcp", "ap-apps"],
tools: {
mcp_discovered_list: {
effect: "read",
examples: [
{ label: "List what other tools configured", args: {}, outcome: "Compact entries `{id, source, scope, name, type}` from claude-code, cursor and goose." },
{ label: "Full entries", args: { full: true, limit: 20 }, outcome: "Adds command, args, env, headers and url; may contain secrets, so avoid logging it." },
],
returns: "`mcps[].id`, to pass as `sourceMcpId` to `mcp_import`; `nextCursor` for more.",
pitfalls: ["Read-only: it never changes the other tools' config. Ids contain the source scope and path, so copy them exactly."],
},
mcp_import: {
effect: "write",
examples: [
{ label: "Import a discovered server", args: { sourceMcpId: "claude-code:project:/path/to/repo:chrome-devtools" }, outcome: "Stores a snapshot and returns the entry (`id`, `alias`, `addedAt`, snapshot), plus `warnings` when something was off." },
{ label: "Import with a tool allow-list", args: { sourceMcpId: "claude-code:project:/path/to/repo:chrome-devtools", alias: "devtools", allowTools: ["list_*", "take_snapshot"] }, outcome: "Only matching tools are visible and callable through every path to this import." },
],
returns: "The entry's `id` (for `mcp_imported_remove`) and `alias` (for `mcp_imported_tool_list` and `mcp_imported_call`).",
pitfalls: [
"Ask the user first: importing lets the daemon run that server's command or reach its URL on your behalf. The tool itself does not ask.",
"The id must come from a fresh `mcp_discovered_list`; an unknown id is refused.",
"Re-importing without `allowTools` keeps the existing list; the pooled connection is dropped so the next read reconnects.",
"`allowTools` accepts exact names or `*` patterns.",
],
},
mcp_imported_list: {
effect: "read",
examples: [
{ label: "List imports", args: {}, outcome: "Compact entries `{id, alias, addedAt, source, name, type}`." },
{ label: "Full snapshot", args: { full: true }, outcome: "Includes the snapshot (command, args, env, headers)." },
],
returns: "`imports[].alias` and `.id`.",
},
mcp_imported_status: {
effect: "read",
examples: [{ label: "See what is connected", args: {}, outcome: "Returns `{ imports }` with each import's connection status, transport type and tool count; connect errors show in `lastError`." }],
returns: "Per-import status; imports that were never used show as not yet connected.",
pitfalls: ["It is refused when the daemon runs without its MCP proxy."],
},
mcp_imported_tool_list: {
effect: "read",
examples: [
{ label: "Names and descriptions", args: { alias: "devtools" }, outcome: "Compact `{name, description}` entries." },
{ label: "With input schemas", args: { alias: "devtools", full: true, limit: 10 }, outcome: "The upstream descriptors verbatim, `inputSchema` included." },
],
returns: "`tools[].name`, to pass as `toolName`, and `inputSchema` with `full: true`.",
pitfalls: [
"The first call connects to the server; a stdio server started by `npx` takes about 1 to 2 seconds, an http or sse one under 100 ms.",
"Tools outside the import's `allowTools` are hidden.",
],
},
mcp_imported_call: {
effect: "external",
examples: [
{ label: "Call an upstream tool", args: { alias: "devtools", toolName: "take_snapshot", args: {} }, outcome: "Returns the upstream result verbatim, including its own `isError` flag." },
],
returns: "The upstream `CallToolResult` (`content`, `isError?`).",
pitfalls: [
"`toolName` is the server's own name, not a namespaced one.",
"The daemon does not validate `args`; the upstream does, and its error comes back as the result.",
"A tool outside `allowTools`, an unknown alias or a connection failure is returned as a tool error naming the alias and tool.",
],
},
mcp_imported_remove: {
effect: "write",
examples: [
{ label: "Remove an unused import", args: { id: "claude-code:project:/path/to/repo:chrome-devtools" }, outcome: "Returns `{ok: true, id}`." },
{ label: "Remove one still mounted", args: { id: "claude-code:project:/path/to/repo:chrome-devtools", confirmInUse: true }, outcome: "Removes it even though live sessions mount it." },
],
returns: "`{ok, id}`.",
pitfalls: ["Without `confirmInUse`, an import mounted by live sessions is refused with `{error: \"import_in_use\", sessionIds}`. `id` is the import id, not the alias."],
},
},
})
59 changes: 59 additions & 0 deletions packages/runtime/src/tool-docs/skill-import.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { defineToolFamilyDoc } from "./types.js"

/**
* Sources: `session-tools.ts` (the four tools), `skill-imports.ts`
* (registry, hash), `session-spawn.ts` (delivery at spawn).
*/
export const skillImportToolDoc = defineToolFamilyDoc({
family: "skill-import",
title: "Imported skills",
summary:
"Copy a skill folder into the daemon's curated set so spawned sessions can receive it, keep the copy in step with its source, and remove it.",
whenToUse: [
"A `SKILL.md` folder on disk should be delivered to the sessions you spawn.",
"The source of an imported skill changed and the daemon's copy must catch up.",
"See which skills the daemon holds, or remove one.",
],
workflow: [
"Call `skill_import {path}` with the folder that holds `SKILL.md`; the entry's `id` defaults to the frontmatter `name`.",
"Spawn a session with that id in its `skills` list (for example `agent_start {skills: [id]}`); on an adapter that delivers session skills the copy is placed in its config.",
"After editing the source, call `skill_resync {id}`; `changed` says whether anything was copied.",
],
cliCommands: [],
seeAlso: ["mcp-import"],
tools: {
skill_import: {
effect: "write",
examples: [
{ label: "Import a skill folder", args: { path: "/path/to/skills/code-review" }, outcome: "Copies the folder to the daemon's skills directory and returns the entry (`id`, `alias`, `addedAt`, `sha`)." },
{ label: "Import under another name", args: { path: "/path/to/skills/code-review", alias: "review-helper" }, outcome: "Same, but the entry and its directory are named `review-helper`." },
],
returns: "`id`, to pass in a spawn's `skills`, to `skill_resync` and to `skill_imported_remove`.",
pitfalls: [
"`path` is the folder that contains `SKILL.md`, not the file.",
"`alias` must be a bare slug: lowercase letters and digits with single hyphens, at most 64 characters.",
"The copy is a snapshot: it survives the source being moved or deleted, and it does not follow edits until `skill_resync`.",
],
},
skill_imported_list: {
effect: "read",
examples: [
{ label: "List imported skills", args: {}, outcome: "Compact entries `{id, alias, addedAt, sha}`." },
{ label: "With source paths", args: { full: true }, outcome: "Adds `sourcePath`." },
],
returns: "`imports[].id`.",
},
skill_resync: {
effect: "write",
examples: [{ label: "Pick up edits", args: { id: "code-review" }, outcome: "Returns the entry with `changed: true` after a re-copy, `changed: false` when the content hash is unchanged." }],
returns: "The entry, `changed`, and `warnings`.",
pitfalls: ["A source folder that is gone is reported as a warning and the existing copy is kept; an unknown `id` is an error."],
},
skill_imported_remove: {
effect: "write",
examples: [{ label: "Remove a skill", args: { id: "code-review" }, outcome: "Deletes the entry and its copied folder; returns `{ok: true, id}`." }],
returns: "`{ok, id}`.",
pitfalls: ["Only the daemon's copy is deleted, never the source folder. An unknown `id` is an error."],
},
},
})
Loading
Loading