Skip to main content
Glama

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
NameRequiredDescriptionDefault
serviceYes

Implementation Reference

  • 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"], }, },
  • 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; }
  • 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(), });
  • Dispatch handler in main tool switch statement that calls service.rootFolderList() for 'root_folders' tool.
    case "root_folders": return await service.rootFolderList();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/thesammykins/FlixBridge'

If you have feedback or need assistance with the MCP directory API, please join our Discord server