List Folders
keychain_list_foldersList personal folders in your Bitwarden vault to retrieve folder IDs for organizing items. Returns safe summaries of folder names and IDs.
Instructions
List personal Bitwarden folders visible to the current user. Use this to discover folder ids for item organization; returns safe folder id/name summaries only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| search | No | Optional text filter; empty means no text filter. | |
| limit | No | Maximum returned rows (1-500). |
Implementation Reference
- src/sdk/keychainSdk.ts:1091-1102 (handler)The actual handler for listFolders. It calls `bw list folders` via bw CLI, optionally filtering by search text, then applies an optional limit. Returns the parsed JSON array of folders.
async listFolders(input: ListFoldersInput = {}): Promise<unknown[]> { const { limit } = input; const folders = await this.bw.withSession(async (session) => { const args: string[] = ['list', 'folders']; if (input.search) args.push('--search', input.search); const { stdout } = await this.bw.runForSession(session, args, { timeoutMs: 60_000, }); return this.parseBwJson<unknown[]>(stdout); }); return typeof limit === 'number' ? folders.slice(0, limit) : folders; } - src/sdk/keychainSdk.ts:175-178 (schema)Input type definition for ListFoldersInput: optional search string and optional limit number.
export interface ListFoldersInput { search?: string; limit?: number; } - src/tools/registerTools.ts:795-824 (registration)Registration of the tool named `${deps.toolPrefix}.list_folders` (defaults to 'keychain_list_folders'). Defines input schema (search, limit), description, and delegates to sdk.listFolders().
registerTool( `${deps.toolPrefix}.list_folders`, { title: 'List Folders', description: 'List personal Bitwarden folders visible to the current user. Use this to discover folder ids for item organization; returns safe folder id/name summaries only.', annotations: { readOnlyHint: true }, inputSchema: { search: searchSchema, limit: limitSchema, }, _meta: toolMeta, }, async (input, extra) => { const sdk = await deps.getSdk(extra.authInfo); const folders = await sdk.listFolders(input); const results = folders .filter((x) => x && typeof x === 'object') .map((x) => { const rec = x as Record<string, unknown>; return { id: rec.id, name: rec.name }; }); return { structuredContent: { results }, content: [ { type: 'text', text: formatResultsText('folder(s)', results) }, ], }; }, );