keychain_restore_item
Recover deleted items from your Bitwarden vault by specifying their unique ID to restore access to stored credentials.
Instructions
Restore an item from trash by id.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/sdk/keychainSdk.ts:1165-1188 (handler)The `restoreItem` function in `KeychainSdk` handles the logic to restore a Bitwarden item from trash using `bw restore item`.
async restoreItem(input: { id: string; reveal?: boolean }): Promise<unknown> { return this.bw.withSession(async (session) => { if (this.syncOnWrite()) { await this.bw .runForSession(session, ['sync'], { timeoutMs: 120_000 }) .catch(() => {}); } const { stdout } = await this.bw.runForSession( session, ['restore', 'item', input.id], { timeoutMs: 60_000 }, ); // restore may not return JSON; ignore stdout and refetch. void stdout; const { stdout: gotOut } = await this.bw.runForSession( session, ['get', 'item', input.id], { timeoutMs: 60_000 }, ); return this.maybeRedact(JSON.parse(gotOut) as AnyRecord, input.reveal); }); } - src/tools/registerTools.ts:793-811 (registration)Tool registration for `keychain_restore_item` (labeled as `.restore_item` internally).
`${deps.toolPrefix}.restore_item`, { title: 'Restore Item', description: 'Restore an item from trash by id.', inputSchema: { id: z.string(), }, _meta: toolMeta, }, async (input, extra) => { if (isReadOnly) return readonlyBlocked(); const sdk = await deps.getSdk(extra.authInfo); const item = await sdk.restoreItem(input); return { structuredContent: { item }, content: [{ type: 'text', text: 'Restored.' }], }; }, );