list-tables
Browse all tables in your Xano workspace to manage database structure and understand available data resources.
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' tool using server.tool, including name, description, empty input schema, and inline handler function.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:139-176 (handler)Handler function that executes the tool: calls Xano API to list tables, formats response as markdown list with details (ID, name, description, dates, tags), returns as text content block. Includes error handling returning error message.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 tool takes no parameters.{},
- src/index.ts:81-131 (helper)Helper function makeXanoRequest used by the handler to make authenticated API calls to Xano workspace endpoints.input?: any[]; } // Server configuration const SERVER_CONFIG = { name: "xano-mcp", version: "1.0.0", description: "MCP server for interacting with Xano database and APIs", }; // Create server instance with better configuration console.error(`[Setup] Creating MCP server: ${SERVER_CONFIG.name} v${SERVER_CONFIG.version}`); const server = new McpServer({ name: SERVER_CONFIG.name, version: SERVER_CONFIG.version, }); // Helper function for making Xano API requests 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; }