Skip to main content
Glama

list_tables

Retrieve all tables in a specified or contextual database using the MCP server mcp-turso-cloud. Simplify database management and query operations with this tool.

Instructions

Lists all tables in a database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseNoDatabase name (optional, uses context if not provided)

Implementation Reference

  • Handler function for the list_tables tool that resolves the database context, calls the database client helper, and formats the response.
    async ({ database }) => {
    	try {
    		const database_name = resolve_database_name(database);
    		if (database) set_current_database(database);
    
    		const tables = await database_client.list_tables(database_name);
    		return create_tool_response({ database: database_name, tables });
    	} catch (error) {
    		return create_tool_error_response(error);
    	}
    },
  • Zod input schema used by the list_tables tool: optional database name (uses current context if omitted).
    const DatabaseOnlySchema = z.object({
    	database: z.string().optional().describe('Database name (optional, uses context if not provided)'),
    });
  • Registration of the list_tables tool with MCP server, specifying name, description, and input schema.
    server.tool(
    	{
    		name: 'list_tables',
    		description: 'Lists all tables in a database',
    		schema: DatabaseOnlySchema,
    	},
  • Core helper function that creates a read-only database client and queries sqlite_schema to retrieve non-system table names.
    export async function list_tables(
    	database_name: string,
    ): Promise<string[]> {
    	try {
    		const client = await get_database_client(
    			database_name,
    			'read-only',
    		);
    
    		// Query the sqlite_schema table to get all tables
    		const result = await client.execute({
    			sql: `SELECT name FROM sqlite_schema 
                WHERE type = 'table' 
                AND name NOT LIKE 'sqlite_%'
                ORDER BY name`,
    		});
    
    		// Extract table names from the result
    		return result.rows.map((row) => row.name as string);
    	} catch (error) {
    		throw new TursoApiError(
    			`Failed to list tables for database ${database_name}: ${
    				(error as Error).message
    			}`,
    			500,
    		);
    	}
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it 'Lists all tables' but doesn't mention whether this requires authentication, has rate limits, returns paginated results, or what format the output takes. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core purpose and appropriately sized for a simple list operation, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the output looks like (e.g., list of table names, metadata), behavioral constraints, or how it interacts with sibling tools. For a tool in a database context with multiple related tools, more contextual guidance is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description doesn't explicitly mention the 'database' parameter, but since schema description coverage is 100% (the schema fully documents the optional database parameter), the baseline score is 3. The description doesn't add meaning beyond the schema, but the schema adequately covers the single parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Lists') and resource ('all tables in a database'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'list_databases' or 'describe_table', which would require mentioning it's specifically about tables rather than databases or table details.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list_databases' for databases or 'describe_table' for table details. It lacks any mention of prerequisites, context, or exclusions, leaving the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/spences10/mcp-turso-cloud'

If you have feedback or need assistance with the MCP directory API, please join our Discord server