list_desktop_routes
List all desktop routes including pages, menus, groups, and tabs in NocoBase v2, returning type and schemaUid for each.
Instructions
List all desktop routes (pages and menus) in NocoBase v2. Each route has a type: 'page', 'flowPage', 'group', 'tabs'. Use schemaUid to fetch page content. Works for both classic pages and flowPages.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pageSize | No | Number of routes per page (default 100) |
Implementation Reference
- src/index.ts:184-194 (registration)Registration of the 'list_desktop_routes' tool with server.registerTool(), including description, input schema, and handler.
server.registerTool( "list_desktop_routes", { description: "List all desktop routes (pages and menus) in NocoBase v2. Each route has a type: 'page', 'flowPage', 'group', 'tabs'. Use schemaUid to fetch page content. Works for both classic pages and flowPages.", inputSchema: { pageSize: z.number().optional().describe("Number of routes per page (default 100)"), }, }, async ({ pageSize = 100 }) => ok(await nocoFetch(`/api/desktopRoutes?pageSize=${pageSize}`)) ); - src/index.ts:192-194 (handler)Handler function for the tool: accepts optional pageSize, calls nocoFetch to GET /api/desktopRoutes, wraps result in ok().
async ({ pageSize = 100 }) => ok(await nocoFetch(`/api/desktopRoutes?pageSize=${pageSize}`)) ); - src/index.ts:188-190 (schema)Input schema definition: pageSize is an optional number (default 100).
inputSchema: { pageSize: z.number().optional().describe("Number of routes per page (default 100)"), }, - src/index.ts:18-27 (helper)nocoFetch helper used by the handler to make authenticated HTTP requests to the NocoBase API.
async function nocoFetch(path: string, options: RequestInit = {}): Promise<unknown> { const url = `${NOCOBASE_URL}${path}`; const res = await fetch(url, { ...options, headers: { ...reqHeaders, ...(options.headers as Record<string, string> | undefined) }, }); const text = await res.text(); if (!res.ok) throw new Error(`HTTP ${res.status} ${res.statusText}: ${text}`); try { return JSON.parse(text); } catch { return text; } } - src/index.ts:29-31 (helper)ok() helper that wraps data into the MCP content response format.
const ok = (data: unknown) => ({ content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }], });