gui_browse
Search and organize Anki cards using a query and optional sorting by column with ascending or descending order for efficient card management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query to browse cards | |
| reorderCards | No | Optional reordering configuration |
Implementation Reference
- src/tools/graphical.ts:88-109 (handler)The handler function that implements the core logic of the 'gui_browse' tool. It prepares parameters, invokes the underlying Anki graphical guiBrowse method, and returns a response with the number of cards found.async ({ query, reorderCards }) => { try { const params: any = { query }; if (reorderCards) { params.reorderCards = reorderCards; } const cardIds = await ankiClient.graphical.guiBrowse(params); return { content: [ { type: 'text', text: `Opened browser with query "${query}". Found ${cardIds.length} cards: ${JSON.stringify(cardIds)}`, }, ], }; } catch (error) { throw new Error( `Failed to open browser: ${error instanceof Error ? error.message : String(error)}` ); } }
- src/tools/graphical.ts:78-87 (schema)Zod schema defining the input parameters for the 'gui_browse' tool: a required 'query' string and an optional 'reorderCards' object.{ query: z.string().describe('Search query to browse cards'), reorderCards: z .object({ columnId: z.string().describe('Column to sort by'), order: z.enum(['ascending', 'descending']).describe('Sort order'), }) .optional() .describe('Optional reordering configuration'), },
- src/tools/graphical.ts:76-110 (registration)The 'gui_browse' MCP tool is registered here within the registerGraphicalTools function using server.tool(), specifying the tool name, input schema, and handler implementation.server.tool( 'gui_browse', { query: z.string().describe('Search query to browse cards'), reorderCards: z .object({ columnId: z.string().describe('Column to sort by'), order: z.enum(['ascending', 'descending']).describe('Sort order'), }) .optional() .describe('Optional reordering configuration'), }, async ({ query, reorderCards }) => { try { const params: any = { query }; if (reorderCards) { params.reorderCards = reorderCards; } const cardIds = await ankiClient.graphical.guiBrowse(params); return { content: [ { type: 'text', text: `Opened browser with query "${query}". Found ${cardIds.length} cards: ${JSON.stringify(cardIds)}`, }, ], }; } catch (error) { throw new Error( `Failed to open browser: ${error instanceof Error ? error.message : String(error)}` ); } } );