Skip to main content
Glama
sam2332

SQLite MCP Server

by sam2332

list_tables

Retrieve all table names from a connected SQLite database to understand its structure and available data sources.

Instructions

List all tables in the connected database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the list_tables tool. It checks for a connected database, queries sqlite_master for user-created tables, formats them into a comma-separated list, and returns the result as a text content response.
    private async listTables(): Promise<CallToolResult> {
      if (!this.db) {
        throw new Error("No database connected. Use connect_database first.");
      }
    
      try {
        const tables = this.db
          .prepare("SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' ORDER BY name")
          .all() as { name: string }[];
    
        const tableList = tables.map(t => t.name).join(", ");
        
        return {
          content: [
            {
              type: "text",
              text: `Tables in database (${tables.length}): ${tableList || "No tables found"}`,
            } satisfies TextContent,
          ],
        };
      } catch (error) {
        throw new Error(`Failed to list tables: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • src/index.ts:78-85 (registration)
    Registration of the list_tables tool in the ListToolsRequestHandler. Includes the tool name, description, and input schema (empty object since no parameters required).
    {
      name: "list_tables",
      description: "List all tables in the connected database",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • Input schema definition for the list_tables tool, which is an empty object indicating no input parameters are required.
    inputSchema: {
      type: "object",
      properties: {},
    },
  • src/index.ts:165-166 (registration)
    Switch case in the CallToolRequestHandler that dispatches calls to the list_tables tool by invoking the listTables() handler method.
    case "list_tables":
      return await this.listTables();
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 the action ('List all tables') but doesn't mention any behavioral traits like whether this is a read-only operation, if it requires specific permissions, how results are formatted, or if there are rate limits. This leaves significant gaps for a tool that interacts with a database.

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, clear sentence with no wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every part of the sentence contributes directly to understanding the tool's purpose.

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 complexity of database interactions and the lack of annotations and output schema, the description is incomplete. It doesn't address what the output looks like (e.g., list format, error handling), behavioral aspects like safety or permissions, or how it fits with siblings. For a tool with no structured support, more context is needed.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't add parameter details, as there are none to explain. This meets the baseline for tools with no parameters.

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 ('List') and resource ('all tables in the connected database'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_table_info' or 'describe_table', which might also provide table-related information but with different scopes or 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 such as 'get_table_info' or 'describe_table'. It lacks context about prerequisites (e.g., needing to connect to a database first) or exclusions, leaving the agent to infer usage based on tool names 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

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/sam2332/mcp-quick-sqlite3'

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