List Org Collections
keychain_list_org_collectionsList organization-scoped collections by organization ID. Returns collection IDs and names for vault management.
Instructions
List organization-scoped collections for the required organizationId. Use this after discovering an organization to find collection ids; returns safe id/name summaries.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organizationId | Yes | Bitwarden organization id; required for org-scoped collection operations. | |
| search | No | Optional text filter; empty means no text filter. | |
| limit | No | Maximum returned rows (1-500). |
Implementation Reference
- src/tools/registerTools.ts:897-934 (registration)MCP tool registration for 'list_org_collections' - defines the input schema (organizationId required, search+limit optional), calls sdk.listOrgCollections(), maps results to id/name/organizationId summaries, and returns structured + text content.
registerTool( `${deps.toolPrefix}.list_org_collections`, { title: 'List Org Collections', description: 'List organization-scoped collections for the required organizationId. Use this after discovering an organization to find collection ids; returns safe id/name summaries.', annotations: { readOnlyHint: true }, inputSchema: { organizationId: organizationIdSchema, search: searchSchema, limit: limitSchema, }, _meta: toolMeta, }, async (input, extra) => { const sdk = await deps.getSdk(extra.authInfo); const cols = await sdk.listOrgCollections(input); const results = cols .filter((x) => x && typeof x === 'object') .map((x) => { const rec = x as Record<string, unknown>; return { id: rec.id, name: rec.name, organizationId: rec.organizationId ?? null, }; }); return { structuredContent: { results }, content: [ { type: 'text', text: formatResultsText('org collection(s)', results), }, ], }; }, ); - src/sdk/keychainSdk.ts:1186-1206 (handler)Core handler for listOrgCollections - calls `bw list org-collections --organizationid <id>` via a session, optionally adds --search filter, parses JSON output, and applies limit.
async listOrgCollections(input: { organizationId: string; search?: string; limit?: number; }): Promise<unknown[]> { const { limit } = input; const cols = await this.bw.withSession(async (session) => { const args: string[] = [ 'list', 'org-collections', '--organizationid', input.organizationId, ]; 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' ? cols.slice(0, limit) : cols; } - src/sdk/keychainSdk.ts:186-189 (schema)TypeScript interface for the input schema used by listOrganizations (the input type for listOrgCollections is defined inline).
export interface ListOrganizationsInput { search?: string; limit?: number; } - src/tools/registerTools.ts:204-213 (helper)Helper used to format the org collection results into readable text output.
function formatResultsText(label: string, results: unknown[]): string { if (textCompatMode === 'structured_json') { return JSON.stringify({ results }); } if (results.length === 0) return `Found 0 ${label}.`; return [ `Found ${results.length} ${label}:`, ...results.map(formatItemSummary), ].join('\n'); }