keychain_create_note
Create secure notes in your Bitwarden vault to store sensitive information with customizable fields and organizational options.
Instructions
Create a secure note item.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| notes | No | ||
| fields | No | ||
| favorite | No | ||
| organizationId | No | ||
| collectionIds | No | ||
| folderId | No |
Implementation Reference
- src/tools/registerTools.ts:1401-1433 (handler)Tool registration for "keychain_create_note" calling SDK's createNote method.
`${deps.toolPrefix}.create_note`, { title: 'Create Note', description: 'Create a secure note item.', inputSchema: { name: z.string(), notes: z.string().optional(), fields: z .array( z.object({ name: z.string(), value: z.string(), hidden: z.boolean().optional(), }), ) .optional(), favorite: z.boolean().optional(), organizationId: z.string().optional(), collectionIds: z.array(z.string()).optional(), folderId: z.string().optional(), }, _meta: toolMeta, }, async (input, extra) => { if (isReadOnly) return readonlyBlocked(); const sdk = await deps.getSdk(extra.authInfo); const created = await sdk.createNote(input); return { structuredContent: { item: created }, content: [{ type: 'text', text: 'Created.' }], }; }, ); - src/sdk/keychainSdk.ts:1551-1607 (handler)Implementation of createNote method in KeychainSdk, which constructs a note and calls the Bitwarden CLI.
async createNote(input: { name: string; notes?: string; fields?: ItemFieldInput[]; reveal?: boolean; favorite?: boolean; organizationId?: string; collectionIds?: string[]; folderId?: string; }): Promise<unknown> { return this.bw.withSession(async (session) => { if (this.syncOnWrite()) { await this.bw .runForSession(session, ['sync'], { timeoutMs: 120_000, }) .catch(() => {}); } const tpl = (await this.bw.getTemplateItemForSession( session, )) as AnyRecord; const item = deepClone(tpl); item.type = ITEM_TYPE.note; item.name = input.name; item.notes = input.notes ?? ''; item.favorite = input.favorite ?? false; if (input.organizationId) item.organizationId = input.organizationId; if (input.folderId) item.folderId = input.folderId; if (!item.secureNote || typeof item.secureNote !== 'object') { item.secureNote = { type: 0 }; } item.fields = normalizeFields(input.fields) ?? []; if (input.collectionIds) item.collectionIds = input.collectionIds; const encoded = encodeJsonForBw(item); const { stdout } = await this.bw.runForSession( session, ['create', 'item', encoded], { timeoutMs: 120_000 }, ); const created = this.parseBwJson<AnyRecord>(stdout); if (input.collectionIds?.length) { const encodedCols = encodeJsonForBw(input.collectionIds); await this.bw .runForSession( session, ['edit', 'item-collections', String(created.id), encodedCols], { timeoutMs: 120_000 }, ) .catch(() => {}); } return this.maybeRedact(created, input.reveal); }); }