api_reflect
Retrieve and reflect all actions or specific scopes within the Anki MCP server for API integration and resource management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| actions | No | List of action names to reflect, or null for all | |
| scopes | Yes | Scopes to reflect |
Implementation Reference
- src/tools/miscellaneous.ts:9-37 (registration)Full registration of the 'api_reflect' MCP tool, including descriptive comment, Zod input schema (actions and scopes parameters), and async handler function that proxies to ankiClient.miscellaneous.apiReflect() and formats the reflection data as text content.// Tool: Get API reflection information server.tool( 'api_reflect', { actions: z .array(z.string()) .nullable() .optional() .describe('List of action names to reflect, or null for all'), scopes: z.array(z.enum(['actions'])).describe('Scopes to reflect'), }, async ({ actions = null, scopes }) => { try { const reflection = await ankiClient.miscellaneous.apiReflect({ actions, scopes }); return { content: [ { type: 'text', text: `API reflection: ${JSON.stringify(reflection, null, 2)}`, }, ], }; } catch (error) { throw new Error( `Failed to get API reflection: ${error instanceof Error ? error.message : String(error)}` ); } } );
- src/tools/miscellaneous.ts:20-36 (handler)The core handler function for the 'api_reflect' tool. It calls the underlying AnkiConnect apiReflect method via ankiClient, stringifies the result, and returns it as MCP text content. Includes error handling.async ({ actions = null, scopes }) => { try { const reflection = await ankiClient.miscellaneous.apiReflect({ actions, scopes }); return { content: [ { type: 'text', text: `API reflection: ${JSON.stringify(reflection, null, 2)}`, }, ], }; } catch (error) { throw new Error( `Failed to get API reflection: ${error instanceof Error ? error.message : String(error)}` ); } }
- src/tools/miscellaneous.ts:12-19 (schema)Zod schema defining the input parameters for the 'api_reflect' tool: optional nullable array of action names, and array of scopes (limited to 'actions').{ actions: z .array(z.string()) .nullable() .optional() .describe('List of action names to reflect, or null for all'), scopes: z.array(z.enum(['actions'])).describe('Scopes to reflect'), },
- src/tools/miscellaneous.ts:279-279 (helper)'apiReflect' is listed as a supported action in the 'multi' tool's enum, allowing it to be used in batch operations.'apiReflect',