w3_plan_get
Retrieve the storage plan details for a specified or currently authorized account on the MCP IPFS Server to manage data storage and access.
Instructions
Displays the plan associated with the current or specified account.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accountId | No | Optional account ID to get plan for (defaults to current authorized account). |
Implementation Reference
- src/tool_handlers.ts:668-697 (handler)The main execution handler for the 'w3_plan_get' tool. It validates arguments using the schema, runs the 'w3 plan get [--account ID]' command via runW3Command, parses the NDJSON stdout output, and returns structured plan data or throws detailed errors.const handleW3PlanGet: ToolHandler = async (args) => { const parsed = Schemas.W3PlanGetArgsSchema.safeParse(args); if (!parsed.success) throw new Error( `Invalid arguments for w3_plan_get: ${parsed.error.message}` ); const { accountId } = parsed.data; let command = "plan get"; if (accountId) command += ` --account ${accountId}`; const { stdout } = await runW3Command(command); try { const planData = parseNdJson(stdout); return { content: [ { type: "text", text: JSON.stringify({ message: "Plan information retrieved.", planData: planData.length > 0 ? planData[0] : {}, }), }, ], }; } catch (e) { logger.warn(`w3_plan_get: Failed to parse output as NDJSON: ${stdout}`); throw new Error( `Failed to parse JSON output for w3_plan_get. Raw output: ${stdout}` ); } };
- src/schemas.ts:286-297 (schema)Zod input schema for the w3_plan_get tool, defining an optional 'accountId' string parameter.export const W3PlanGetArgsSchema = z .object({ accountId: z .string() .optional() .describe( "Optional account ID to get plan for (defaults to current authorized account)." ), }) .describe( "Displays the plan associated with the current or specified account." );
- src/tool_handlers.ts:943-980 (registration)The exported toolHandlers map registers all tool handlers, including 'w3_plan_get: handleW3PlanGet' at line 969. This map is imported and used in src/index.ts to dispatch CallTool requests to the appropriate handler.// Tool Handlers Map export const toolHandlers: Record<string, ToolHandler> = { w3_login: handleW3Login, w3_space_ls: handleW3SpaceLs, w3_space_use: handleW3SpaceUse, w3_space_create: handleW3SpaceCreate, w3_up: handleW3Up, w3_ls: handleW3Ls, w3_rm: handleW3Rm, w3_open: handleW3Open, w3_space_info: handleW3SpaceInfo, w3_space_add: handleW3SpaceAdd, w3_delegation_create: handleW3DelegationCreate, w3_delegation_ls: handleW3DelegationLs, w3_delegation_revoke: handleW3DelegationRevoke, w3_proof_add: handleW3ProofAdd, w3_proof_ls: handleW3ProofLs, w3_key_create: handleW3KeyCreate, w3_bridge_generate_tokens: handleW3BridgeGenerateTokens, w3_can_blob_add: handleW3CanBlobAdd, w3_can_blob_ls: handleW3CanBlobLs, w3_can_blob_rm: handleW3CanBlobRm, w3_can_index_add: handleW3CanIndexAdd, w3_can_upload_add: handleW3CanUploadAdd, w3_can_upload_ls: handleW3CanUploadLs, w3_can_upload_rm: handleW3CanUploadRm, w3_plan_get: handleW3PlanGet, w3_account_ls: handleW3AccountLs, w3_space_provision: handleW3SpaceProvision, w3_coupon_create: handleW3CouponCreate, w3_usage_report: handleW3UsageReport, w3_can_access_claim: handleW3CanAccessClaim, w3_can_store_add: handleW3CanStoreAdd, w3_can_store_ls: handleW3CanStoreLs, w3_can_store_rm: handleW3CanStoreRm, w3_can_filecoin_info: handleW3CanFilecoinInfo, w3_reset: handleW3Reset, };