mcp.test
Starts the workspace’s enabled MCP servers (or name) afresh from the daemon, stdio and HTTP, waits for initialize and tools/list (timeoutSeconds, default the entry’s timeout, else 60), stops them and answers each connected with its tool names or failed with the error and stderr tail (PRT-500).
Params: McpTestParams
Section titled “Params: McpTestParams”/** `mcp.tools` params (PRT-434). *//** `mcp.test` params (PRT-500). */export type McpTestParams = { /** The server to test; without it every enabled server is. */ name?: string | null; /** How long each server gets to answer `initialize` and `tools/list`, 1..600; default its entry's `timeout`, else 60. */ timeoutSeconds?: number | null; workspaceId: string;};Result: McpServers
Section titled “Result: McpServers”/** `workspaces.mcp_servers`, `thread.mcp_servers`, `thread.mcp_reconnect` and `mcp.test` result (PRT-430..PRT-432, PRT-500). */export type McpServers = { /** pi's project config of the workspace, `<workspace>/.pi/mcp.json`, whether it exists or not. */ projectConfig: string; /** The thread's host runs: its servers' states are its session's. `false` without a thread. */ running: boolean; /** * In precedence order (the first definition of a name wins): `.pi/mcp.json`, the workspace's `mcp.json` and * `.mcp.json`, the init files' `ctx.mcp.define`, then the daemon's `<data>/pi-agent/mcp.json`. */ servers: McpServer[]; /** The thread whose session reported the states; `null` for `workspaces.mcp_servers` and `mcp.test`. */ threadId?: string | null; workspaceId: string;};Types they use
Section titled “Types they use”/** One MCP server configured for the workspace (PRT-433). */export type McpServer = { /** Enabled: its threads connect it and `mcp.test` can start it. */ checkable: boolean; /** Why it failed (`failed`): pi's error, a stdio server's stderr tail after it. */ error?: string | null; name: string; source: McpSource; state: McpState; /** The command of a stdio server (with its arguments), or the URL of a remote one without its query and user info. */ target: string; /** `mcp.test` started the server for this answer (PRT-500): `state` is its outcome, not a thread's. */ tested?: boolean | null; /** The names of the tools it listed, in order: `mcp.test` only (PRT-500). */ toolNames?: string[] | null; /** Tools the server listed (`connected`). */ tools?: number | null; transport: McpTransport;};
/** Where a server is defined. */export type McpSource = { /** Absolute path of the config file, or of the init file declaring it (`omfp`). */ path: string; /** * Whose config it is: `pi` (pi's `.pi/mcp.json` or the daemon's `mcp.json`), `mcp` (the workspace's `mcp.json`), * `claude` (`.mcp.json`) or `omfp` (an init file's `ctx.mcp.define`, `path` naming it). */ tool: string; /** The path relative to the workspace folder when the file is in it (a workspace file the UI can open). */ workspacePath?: string | null;};
/** A server's state as the daemon knows it (PRT-433, DMN-1340). */export type McpState = /** Configured and enabled, not tried: no thread, or the thread is not running. */ | "configured" /** The thread's session started it and waits for its `initialize` and `tools/list` answers. */ | "connecting" /** It answered `initialize` and listed its tools. */ | "connected" /** It could not start, answer or list its tools, or its connection closed: see `error`. */ | "failed" /** `enabled: false`: pi does not load it. */ | "disabled";
/** How a session talks to a server: `stdio` (a command) or `http` (a URL); `sse` is never sent now. */export type McpTransport = "stdio" | "http" | "sse";