image-delete
Remove specific images by ID or delete all images associated with a key on the MCP Index Notes server. Simplify image management and maintain organized data.
Instructions
Delete an image by id or all images by key.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "image-delete"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | ||
| key | No |
Implementation Reference
- src/mcp.ts:1413-1426 (handler)Handler for 'image-delete' tool call. Parses arguments using ImageDeleteSchema, checks for image support in store, deletes image by ID using deleteImageById or all by key using deleteImagesByKey, returns JSON result.
case 'image-delete': { const parsed = ImageDeleteSchema.parse(args ?? {}); if (!('deleteImageById' in (db as any))) { throw new Error('Image storage not supported in current store implementation'); } if (parsed.id) { const ok = (db as any).deleteImageById(parsed.id); return { content: [{ type: 'text', text: JSON.stringify({ ok }) }] }; } if (parsed.key) { const deleted = (db as any).deleteImagesByKey(parsed.key); return { content: [{ type: 'text', text: JSON.stringify({ deleted }) }] }; } return { content: [{ type: 'text', text: JSON.stringify({ error: 'Provide id or key' }) }] }; - src/types.ts:111-115 (schema)Zod schema ImageDeleteSchema used to validate input for image-delete tool: optional id (number) or key (string).
export const ImageDeleteSchema = z.object({ id: z.number().int().positive().optional(), key: z.string().optional(), }); export type ImageDeleteInput = z.infer<typeof ImageDeleteSchema>; - src/mcp.ts:90-97 (registration)Tool registration in the tools array exported for MCP ListTools. Defines name, description, and basic input schema.
name: 'image-delete', description: 'Delete an image by id or all images by key.', inputSchema: { type: 'object', properties: { id: { type: 'number' }, key: { type: 'string' } }, }, }, { - src/db.ts:219-222 (helper)Database method to delete a single image by its ID. Used by image-delete handler when id is provided.
deleteImageById(id: number): boolean { const info = this.db.prepare(`DELETE FROM images WHERE id = ?`).run(id); return info.changes > 0; } - src/db.ts:224-227 (helper)Database method to delete all images associated with a specific key. Used by image-delete handler when key is provided.
deleteImagesByKey(key: string): number { const info = this.db.prepare(`DELETE FROM images WHERE key = ?`).run(key); return info.changes; }