get_accounts
Retrieve a list of accounts with pagination and filters including search, user ID, key contact, and account type.
Instructions
Get all accounts
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | Cursor for fetching the next page of results | |
| per_page | No | Number of results per page (default: 25) | |
| search | No | Filter results on search | |
| key_contact_user_id | No | Filter results on key_contact_user_id | |
| user_id | No | Filter results on user_id | |
| account_type | No | Filter results on account_type |
Implementation Reference
- src/tools/accounts.ts:22-46 (handler)The handler function for the get_accounts tool. It calls apiList on /accounts with optional filter parameters (cursor, per_page, search, key_contact_user_id, user_id, account_type), logs the response, formats results using formatList, and appends a next-page cursor hint if pagination is available.
async ({ cursor, per_page, search, key_contact_user_id, user_id, account_type }) => { try { const result = await apiList<EduframeRecord>("/accounts", { cursor, per_page, search, key_contact_user_id, user_id, account_type, }); void logResponse( "get_accounts", { cursor, per_page, search, key_contact_user_id, user_id, account_type }, result, ); const toolResult = formatList(result.records, "accounts"); if (result.nextCursor) { toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` }); } return toolResult; } catch (error) { return formatError(error); } }, ); - src/tools/accounts.ts:10-20 (schema)Input schema for the get_accounts tool. All parameters are optional: cursor (string), per_page (positive int), search (string), key_contact_user_id (int), user_id (int), and account_type (enum: 'business' | 'personal').
{ description: "Get all accounts", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { cursor: z.string().optional().describe("Cursor for fetching the next page of results"), per_page: z.number().int().positive().optional().describe("Number of results per page (default: 25)"), search: z.string().optional().describe("Filter results on search"), key_contact_user_id: z.number().int().optional().describe("Filter results on key_contact_user_id"), user_id: z.number().int().optional().describe("Filter results on user_id"), account_type: z.enum(["business", "personal"]).optional().describe("Filter results on account_type"), }, - src/tools/accounts.ts:7-8 (registration)The get_accounts tool is registered via server.registerTool inside the registerAccountTools function, using the tool name "get_accounts".
export function registerAccountTools(server: McpServer): void { server.registerTool( - src/tools/index.ts:128-132 (registration)The registerAllTools function iterates over all tool registration functions (including registerAccountTools) and calls each with the MCP server instance.
export function registerAllTools(server: McpServer): void { for (const register of tools) { register(server); } } - src/api.ts:122-137 (helper)The apiList helper function performs a paginated GET request to the API, used by get_accounts to fetch /accounts. It returns both the records array and the next cursor for pagination.
export async function apiList<T>(path: string, query?: Record<string, QueryValue>): Promise<ListResult<T>> { const { token } = getConfig(); const url = buildUrl(path, query); const response = await fetch(url.toString(), { method: "GET", headers: buildHeaders(token), }); await checkResponse(response); const records = (await response.json()) as T[]; const nextCursor = parseNextCursor(response.headers.get("Link")); return { records, nextCursor }; }