Skip to main content
Glama

keychain_delete_items

Remove multiple stored items from a password manager vault by specifying their IDs, with options for temporary or permanent deletion.

Instructions

Delete multiple items by id. Returns per-id results (soft-delete by default; set permanent=true to hard delete).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idsYes
permanentNo

Implementation Reference

  • Implementation of 'deleteItems' that deletes multiple vault items in a single session.
    async deleteItems(input: {
      ids: string[];
      permanent?: boolean;
    }): Promise<Array<{ id: string; ok: boolean; error?: string }>> {
      if (input.ids.length === 0) return [];
      if (input.ids.length > 200) throw new Error('Too many ids (max 200)');
    
      // Run inside a single session lock to avoid re-syncing/unlocking per item.
      return this.bw.withSession(async (session) => {
        if (this.syncOnWrite()) {
          await this.bw
            .runForSession(session, ['sync'], { timeoutMs: 120_000 })
            .catch(() => {});
        }
    
        const results: Array<{ id: string; ok: boolean; error?: string }> = [];
        for (const id of input.ids) {
          try {
            const args = ['delete', 'item', id];
            if (input.permanent) args.push('--permanent');
            await this.bw.runForSession(session, args, { timeoutMs: 60_000 });
            results.push({ id, ok: true });
          } catch (e) {
            results.push({
              id,
              ok: false,
              error: e instanceof Error ? e.message : String(e),
            });
          }
        }
        return results;
      });
    }
  • Registration and handler for the 'delete_items' tool.
      `${deps.toolPrefix}.delete_items`,
      {
        title: 'Delete Items',
        description:
          'Delete multiple items by id. Returns per-id results (soft-delete by default; set permanent=true to hard delete).',
        inputSchema: {
          ids: z.array(z.string()).min(1).max(200),
          permanent: z.boolean().optional(),
        },
        _meta: toolMeta,
      },
      async (input, extra) => {
        if (isReadOnly) return readonlyBlocked();
        const sdk = await deps.getSdk(extra.authInfo);
        const results = await sdk.deleteItems(input);
        const okCount = results.filter((r) => r.ok).length;
        return {
          structuredContent: { results, okCount, total: results.length },
          content: [
            { type: 'text', text: `Deleted ${okCount}/${results.length}.` },
          ],
        };
      },
    );

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/icoretech/warden-mcp'

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