w3_can_upload_ls
Retrieve detailed upload listings for the current space, including pagination and structured output options, using advanced JSON formatting.
Instructions
Lists uploads registered in the current space (advanced view, shows underlying structure).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | Opaque cursor string from a previous response for pagination. | |
| json | No | Format output as newline delimited JSON (default: true). | |
| pre | No | Return the page of results preceding the cursor. | |
| shards | No | Pretty print with shards in output (ignored if --json is true). | |
| size | No | Desired number of results to return. |
Implementation Reference
- src/tool_handlers.ts:619-645 (handler)The main handler function that executes the tool logic: parses input arguments using the schema, constructs the 'w3 can upload ls' CLI command based on flags (json, shards, size, cursor, pre), runs it via runW3Command utility, parses output as NDJSON if json=true, and formats the response as MCP tool content.const handleW3CanUploadLs: ToolHandler = async (args) => { const parsed = Schemas.W3CanUploadLsArgsSchema.safeParse(args); if (!parsed.success) throw new Error( `Invalid arguments for w3_can_upload_ls: ${parsed.error.message}` ); const { json, shards, size, cursor, pre } = parsed.data; let command = "can upload ls"; if (json) command += " --json"; if (shards) command += " --shards"; if (size) command += ` --size ${size}`; if (cursor) command += ` --cursor ${cursor}`; if (pre) command += " --pre"; const { stdout } = await runW3Command(command); if (json) { const uploads = parseNdJson(stdout); return { content: [{ type: "text", text: JSON.stringify({ uploads }) }], }; } else { return { content: [ { type: "text", text: JSON.stringify({ output: stdout.trim() }) }, ], }; } };
- src/schemas.ts:242-276 (schema)Zod schema defining the input parameters and validation for the w3_can_upload_ls tool, including options like json, shards, size, cursor, pre.export const W3CanUploadLsArgsSchema = z .object({ json: z .boolean() .optional() .default(true) .describe("Format output as newline delimited JSON (default: true)."), shards: z .boolean() .optional() .default(false) .describe( "Pretty print with shards in output (ignored if --json is true)." ), size: z .number() .int() .positive() .optional() .describe("Desired number of results to return."), cursor: z .string() .optional() .describe( "Opaque cursor string from a previous response for pagination." ), pre: z .boolean() .optional() .default(false) .describe("Return the page of results preceding the cursor."), }) .describe( "Lists uploads registered in the current space (advanced view, shows underlying structure)." );
- src/tool_handlers.ts:967-967 (registration)Maps the tool name 'w3_can_upload_ls' to its handler function in the toolHandlers export, which is used by index.ts to dispatch CallTool requests.w3_can_upload_ls: handleW3CanUploadLs,