w3_account_ls
Lists authorized accounts for the current agent on the storacha.network. Use after w3_login to verify agent linkage and authorization status, especially after reconnecting in ephemeral environments like Docker.
Instructions
Lists all accounts the current agent is authorized for. Use this command after w3_login and email validation to confirm the agent is successfully linked to your storacha.network account(s). Note: Agent state may be ephemeral (e.g., in Docker). Check authorization status with this command after (re)connecting, and use w3_login if needed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tool_handlers.ts:699-725 (handler)The handler function that implements the core logic for the w3_account_ls tool. It validates input arguments using the schema, executes the 'w3 account ls' command, parses the NDJSON output into an accounts array, and returns a formatted response.const handleW3AccountLs: ToolHandler = async (_args) => { const parsed = Schemas.W3AccountLsArgsSchema.safeParse(_args); if (!parsed.success) throw new Error( `Invalid arguments for w3_account_ls: ${parsed.error.message}` ); const { stdout } = await runW3Command("account ls"); try { const accounts = parseNdJson(stdout); return { content: [ { type: "text", text: JSON.stringify({ message: "Authorized accounts retrieved.", accounts, }), }, ], }; } catch (e) { logger.warn(`w3_account_ls: Failed to parse output as NDJSON: ${stdout}`); throw new Error( `Failed to parse JSON output for w3_account_ls. Raw output: ${stdout}` ); } };
- src/schemas.ts:298-302 (schema)Zod schema for input validation of the w3_account_ls tool. It defines an empty object schema since no arguments are required, along with a detailed description.export const W3AccountLsArgsSchema = z .object({}) .describe( "Lists all accounts the current agent is **authorized** for. Use this command after `w3_login` and email validation to confirm the agent is successfully linked to your storacha.network account(s). **Note:** Agent state may be ephemeral (e.g., in Docker). Check authorization status with this command after (re)connecting, and use `w3_login` if needed." );
- src/tool_handlers.ts:970-970 (registration)Registration of the w3_account_ls tool handler in the toolHandlers map, which is used by the MCP server to route CallTool requests to the appropriate handler function.w3_account_ls: handleW3AccountLs,