list-api-groups
Browse and filter all API groups in your Xano workspace to manage endpoints, with pagination, search, and sorting options for organized access.
Instructions
Browse all API groups in the Xano workspace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination | |
| per_page | No | Number of items per page | |
| search | No | Search term to filter API groups | |
| sort | No | Field to sort by | |
| order | No | Sort order |
Implementation Reference
- src/index.ts:796-848 (handler)The asynchronous handler function for the 'list-api-groups' tool. It builds query parameters, fetches API groups from Xano, formats them as markdown, and returns the content or error.async ({ page, per_page, search, sort, order }) => { console.error('[Tool] Executing list-api-groups'); try { // Build query parameters const queryParams = new URLSearchParams(); if (page !== undefined) queryParams.append("page", page.toString()); if (per_page !== undefined) queryParams.append("per_page", per_page.toString()); if (search) queryParams.append("search", search); if (sort) queryParams.append("sort", sort); if (order) queryParams.append("order", order); const queryString = queryParams.toString() ? `?${queryParams.toString()}` : ''; const response = await makeXanoRequest<{ items: XanoApiGroup[], curPage: number, nextPage?: number, prevPage?: number }>( `/workspace/${XANO_WORKSPACE}/apigroup${queryString}` ); const apiGroups = response.items; // Format API groups into a readable structure const formattedContent = `# Xano API Groups\n\n` + `Page ${response.curPage}${response.nextPage ? ` (Next: ${response.nextPage})` : ''}${response.prevPage ? ` (Prev: ${response.prevPage})` : ''}\n\n` + `${apiGroups.map(group => `## ${group.name}\n` + `**ID**: ${group.id}\n` + `**Description**: ${group.description || 'No description'}\n` + `**Created**: ${new Date(group.created_at).toLocaleString()}\n` + `**Updated**: ${new Date(group.updated_at).toLocaleString()}\n` + `${group.guid ? `**GUID**: ${group.guid}\n` : ''}` ).join('\n\n')}`; console.error(`[Tool] Successfully listed ${apiGroups.length} API groups`); return { content: [ { type: "text", text: formattedContent } ] }; } catch (error) { console.error(`[Error] Failed to list API groups: ${error instanceof Error ? error.message : String(error)}`); return { content: [ { type: "text", text: `Error listing API groups: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } }
- src/index.ts:789-795 (schema)Input schema using Zod for the 'list-api-groups' tool parameters: optional pagination, search, sort, and order fields.{ page: z.number().optional().describe("Page number for pagination"), per_page: z.number().optional().describe("Number of items per page"), search: z.string().optional().describe("Search term to filter API groups"), sort: z.enum(["created_at", "updated_at", "name"]).optional().describe("Field to sort by"), order: z.enum(["asc", "desc"]).optional().describe("Sort order") },
- src/index.ts:787-849 (registration)Registration of the 'list-api-groups' tool using server.tool, including name, description, schema, and handler."list-api-groups", "Browse all API groups in the Xano workspace", { page: z.number().optional().describe("Page number for pagination"), per_page: z.number().optional().describe("Number of items per page"), search: z.string().optional().describe("Search term to filter API groups"), sort: z.enum(["created_at", "updated_at", "name"]).optional().describe("Field to sort by"), order: z.enum(["asc", "desc"]).optional().describe("Sort order") }, async ({ page, per_page, search, sort, order }) => { console.error('[Tool] Executing list-api-groups'); try { // Build query parameters const queryParams = new URLSearchParams(); if (page !== undefined) queryParams.append("page", page.toString()); if (per_page !== undefined) queryParams.append("per_page", per_page.toString()); if (search) queryParams.append("search", search); if (sort) queryParams.append("sort", sort); if (order) queryParams.append("order", order); const queryString = queryParams.toString() ? `?${queryParams.toString()}` : ''; const response = await makeXanoRequest<{ items: XanoApiGroup[], curPage: number, nextPage?: number, prevPage?: number }>( `/workspace/${XANO_WORKSPACE}/apigroup${queryString}` ); const apiGroups = response.items; // Format API groups into a readable structure const formattedContent = `# Xano API Groups\n\n` + `Page ${response.curPage}${response.nextPage ? ` (Next: ${response.nextPage})` : ''}${response.prevPage ? ` (Prev: ${response.prevPage})` : ''}\n\n` + `${apiGroups.map(group => `## ${group.name}\n` + `**ID**: ${group.id}\n` + `**Description**: ${group.description || 'No description'}\n` + `**Created**: ${new Date(group.created_at).toLocaleString()}\n` + `**Updated**: ${new Date(group.updated_at).toLocaleString()}\n` + `${group.guid ? `**GUID**: ${group.guid}\n` : ''}` ).join('\n\n')}`; console.error(`[Tool] Successfully listed ${apiGroups.length} API groups`); return { content: [ { type: "text", text: formattedContent } ] }; } catch (error) { console.error(`[Error] Failed to list API groups: ${error instanceof Error ? error.message : String(error)}`); return { content: [ { type: "text", text: `Error listing API groups: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } } );