Lightpanda: the headless browser designed for AI and automation
docs: fold the MCP sessions and resources notes into the partial
Adrià Arrufat64ad7b1adfaa
diff --git a/src/docs.zig b/src/docs.zigindex fc0edccf9..43af87553 100644--- a/src/docs.zig+++ b/src/docs.zig@@ -92,7 +92,13 @@ fn writeMcpTools(w: *Writer) Writer.Error!void {var arena: std.heap.ArenaAllocator = .init(std.heap.page_allocator);defer arena.deinit();- try w.writeAll("## MCP-only tools\n\nThese tools exist only in the MCP server, not in the agent or in scripts.\n\n");+ try w.writeAll(+ \\## MCP-only tools+ \\+ \\These tools exist only in the MCP server, not in the agent or in scripts. Over the [HTTP transport](/usage/mcp#http-transport), every tool call runs in the session the `Mcp-Session-Id` header names, falling back to the always-present `default` session; the `session_*` tools create, list and close those sessions.+ \\+ \\+ );for (mcp_tools.extra_tools) |mt| {try w.print("### {s}\n\n", .{mt.name});if (mt.title) |title| {@@ -111,10 +117,28 @@ fn writeMcpTools(w: *Writer) Writer.Error!void {try w.writeAll("\n\n");}- try w.writeAll("## Resources\n\nRead with `resources/read`.\n\n| URI | MIME type | Description |\n|---|---|---|\n");+ try w.writeAll(+ \\## Resources+ \\+ \\The host application reads these with `resources/read`. The page resources need a loaded page; the skill resources don't.+ \\+ \\| URI | MIME type | Description |+ \\|---|---|---|+ \\+ );for (mcp_resources.resource_list) |r| {try w.print("| `{s}` | `{s}` | {f} |\n", .{ r.uri, r.mimeType orelse "", Cell{ .s = r.description orelse r.name } });}+ try w.writeAll(+ \\+ \\```json copy+ \\{"jsonrpc":"2.0","id":2,"method":"resources/read",+ \\ "params":{"uri":"mcp://page/markdown"}}+ \\```+ \\+ \\The `markdown` tool and the `mcp://page/markdown` resource return the same content; the difference is who initiates. The agent calls **tools** during its workflow, while the host application reads **resources**, e.g. an IDE displaying page state in the background.+ \\+ );}/// The agent REPL's slash commands: meta, LLM-prompt, and one per browserdiff --git a/src/mcp/tools.zig b/src/mcp/tools.zigindex 3999e3f26..54bf0bf67 100644--- a/src/mcp/tools.zig+++ b/src/mcp/tools.zig@@ -105,21 +105,21 @@ pub const extra_tools = [_]McpTool{.name = "session_new",.title = "Create an isolated browser session",.annotations = .{ .destructiveHint = false, .idempotentHint = true, .openWorldHint = false },- .description = "Create a new isolated browser session (its own page, cookies and memory) and return its id. Use it to give a separate agent its own browsing context, or to obtain an id to share. Pass that id back as the `Mcp-Session-Id` header to route calls to it.",+ .description = "Create a new isolated browser session (its own page, cookies and memory) and return its id. Use it to give a separate agent its own browsing context, or to obtain an id to share. Pass that id back as the `Mcp-Session-Id` header to route calls to it. Needs the HTTP transport (`lightpanda mcp --port <PORT>`); over stdio only the `default` session exists and this call returns an error.",.inputSchema = session_new_schema,},.{.name = "session_list",.title = "List browser sessions",.annotations = read_only,- .description = "List the active browser sessions with their id and current URL. The `default` session always exists.",+ .description = "List the active browser sessions with their id and current URL. The `default` session always exists. Needs the HTTP transport (`lightpanda mcp --port <PORT>`); over stdio only the `default` session exists and this call returns an error.",.inputSchema = browser_tools.minify("{ \"type\": \"object\", \"properties\": {} }"),},.{.name = "session_close",.title = "Close a browser session",.annotations = .{ .openWorldHint = false },- .description = "Close a browser session, freeing its page and memory. The `default` session cannot be closed.",+ .description = "Close a browser session, freeing its page and memory. The `default` session cannot be closed. Needs the HTTP transport (`lightpanda mcp --port <PORT>`); over stdio only the `default` session exists and this call returns an error.",.inputSchema = session_id_schema,},};