list-tables
View all tables within your Xano workspace to manage databases, edit schemas, and handle API documentation efficiently.
Instructions
Browse all tables in the Xano workspace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:135-177 (registration)Registration of the 'list-tables' MCP tool using server.tool(). The tool has no input parameters (empty schema), lists all tables in the Xano workspace by calling the Xano API, formats the response as Markdown, and handles errors.server.tool( "list-tables", "Browse all tables in the Xano workspace", {}, async () => { console.error('[Tool] Executing list-tables'); try { const response = await makeXanoRequest<{ items: XanoTable[] }>(`/workspace/${XANO_WORKSPACE}/table`); const tables = response.items; // Access the 'items' property // Format tables into a more readable structure const formattedContent = `# Xano Database Tables\n\n${tables.map(table => `## ${table.name}\n` + `**ID**: ${table.id}\n` + `**Description**: ${table.description || 'No description'}\n` + `**Created**: ${new Date(table.created_at).toLocaleString()}\n` + `**Updated**: ${new Date(table.updated_at).toLocaleString()}\n` + `${table.tags && table.tags.length > 0 ? `**Tags**: ${table.tags.join(', ')}\n` : ''}` ).join('\n\n')}`; console.error(`[Tool] Successfully listed ${tables.length} tables`); return { content: [ { type: "text", text: formattedContent } ] }; } catch (error) { console.error(`[Error] Failed to list tables: ${error instanceof Error ? error.message : String(error)}`); return { content: [ { type: "text", text: `Error listing tables: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } } );
- src/index.ts:138-138 (schema)Empty input schema indicating the 'list-tables' tool requires no parameters.{},
- src/index.ts:99-132 (helper)The makeXanoRequest helper function is used by the list-tables handler to perform authenticated GET requests to the Xano API.async function makeXanoRequest<T>(endpoint: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE' = 'GET', body?: any): Promise<T> { try { console.error(`[API] Making ${method} request to endpoint: ${endpoint}`); if (body) { console.error(`[API] Request body: ${JSON.stringify(body, null, 2)}`); } const url = new URL(`${XANO_API_BASE}${endpoint}`); const headers = { 'Content-Type': 'application/json', 'Authorization': `Bearer ${XANO_API_KEY}`, 'X-Workspace': String(XANO_WORKSPACE) }; const response = await fetch(url.toString(), { method, headers, body: body ? JSON.stringify(body) : undefined, }); if (!response.ok) { const errorText = await response.text(); console.error(`[Error] HTTP error! status: ${response.status}, response: ${errorText}`); throw new Error(`HTTP error! status: ${response.status}, details: ${errorText}`); } const data = await response.json(); console.error(`[API] Successfully received response from endpoint: ${endpoint}`); return data; } catch (error) { console.error(`[Error] Failed to make Xano request to ${endpoint}: ${error instanceof Error ? error.message : String(error)}`); throw error; } }
- src/index.ts:21-28 (schema)TypeScript interface defining the structure of a Xano table object, used in the list-tables response typing.interface XanoTable { id: string; name: string; description?: string; tags?: string[]; created_at: string; updated_at: string; }