root_folders
List configured root folders and storage details for media management services to organize and monitor library structures.
Instructions
List configured root folders and storage information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| service | Yes |
Implementation Reference
- src/services/shared.ts:281-314 (handler)Main handler implementation for root_folders tool. Fetches root folders from /api/v3/rootfolder API endpoint, parses with Zod schema, computes free space, and formats response as RootFolderData.async rootFolderList(): Promise<OperationResult<RootFolderData>> { const operation = withMetrics( this.serviceName, "rootFolderList", async () => { debugOperation(this.serviceName, "rootFolderList"); const response = await fetchJson(this.buildApiUrl("/rootfolder")); const folders = z.array(FolderSchema).parse(response); const folderData = folders.map((f) => ({ id: f.id, path: f.path, freeSpaceBytes: f.freeSpace || 0, })); return { ok: true, data: { service: this.serviceName, mediaKind: this.mediaKind, total: folderData.length, folders: folderData, defaultId: folderData[0]?.id || 1, }, }; }, ); try { return await operation(); } catch (error) { return handleError(error, this.serviceName); } }
- src/index.ts:64-72 (registration)Tool registration in the MCP tools list, including name, description, and input schema requiring 'service' parameter.{ name: "root_folders", description: "List configured root folders and storage information", inputSchema: { type: "object", properties: { service: { type: "string" } }, required: ["service"], }, },
- src/services/base.ts:66-79 (schema)TypeScript interfaces defining the output structure RootFolderData and component RootFolder for root_folders response validation.export interface RootFolder { id: number; path: string; freeSpaceBytes?: number; accessible?: boolean; } export interface RootFolderData { service: string; mediaKind: "series" | "movie"; total: number; folders: RootFolder[]; defaultId?: number; }
- src/services/shared.ts:142-148 (schema)Zod schema used for parsing the API response from /rootfolder endpoint.const FolderSchema = z.object({ id: z.number(), path: z.string(), freeSpace: z.number().optional(), accessible: z.boolean().optional(), });
- src/index.ts:290-291 (handler)Dispatch handler in main tool switch statement that calls service.rootFolderList() for 'root_folders' tool.case "root_folders": return await service.rootFolderList();