Skip to main content
Glama
OpenLinkSoftware

mcp-sqlalchemy

podbc_get_schemas

Retrieve a list of all schema names from a connected database using SQLAlchemy via pyodbc, enabling efficient database schema management.

Instructions

Retrieve and return a list of all schema names from the connected database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNo

Implementation Reference

  • The @mcp.tool decorator registers the 'podbc_get_schemas' tool with its name and description.
    @mcp.tool(
        name="podbc_get_schemas",
        description="Retrieve and return a list of all schema names from the connected database."
    )
  • The handler function that executes the logic: connects to the ODBC database, queries for tables to get unique catalogs (schemas), and returns them as JSON string.
    def podbc_get_schemas(user:Optional[str]=None, password:Optional[str]=None, dsn:Optional[str]=None) -> str:
        """
        Retrieve and return a list of all schema names from the connected database.
    
        Args:
            user (Optional[str]=None): Optional username.
            password (Optional[str]=None): Optional password.
            dsn (Optional[str]=None): Optional dsn name.
    
        Returns:
            str: A list of schema names.
        """
        try:
            with get_connection(True, user, password, dsn) as conn:
                cursor = conn.cursor()
                rs = cursor.tables(table=None, catalog="%", schema=None, tableType=None);
                catalogs = {row[0] for row in rs.fetchall()}
                return json.dumps(list(catalogs))
    
        except pyodbc.Error as e:
            logging.error(f"Error retrieving schemas: {e}")
            raise
  • Input schema defined by function parameters with type hints and documentation; output is str (JSON list of schemas).
    def podbc_get_schemas(user:Optional[str]=None, password:Optional[str]=None, dsn:Optional[str]=None) -> str:
        """
        Retrieve and return a list of all schema names from the connected database.
    
        Args:
            user (Optional[str]=None): Optional username.
            password (Optional[str]=None): Optional password.
            dsn (Optional[str]=None): Optional dsn name.
    
        Returns:
            str: A list of schema names.
        """
  • Helper function to establish pyodbc connection using env vars or provided credentials, used by the tool.
    def get_connection(readonly=True, uid: Optional[str] = None, pwd: Optional[str] = None, 
                    dsn: Optional[str] = None) -> pyodbc.Connection:
        dsn = DB_DSN if dsn is None else dsn
        uid = DB_UID if uid is None else uid
        pwd = DB_PWD if pwd is None else pwd
    
        if dsn is None:
            raise ValueError("ODBC_DSN environment variable is not set.")
        if uid is None:
            raise ValueError("ODBC_USER environment variable is not set.")
        if pwd is None:
            raise ValueError("ODBC_PASSWORD environment variable is not set.")
    
        dsn_string = f"DSN={dsn};UID={uid};PWD={pwd}"
        logging.info(f"DSN:{dsn}  UID:{uid}")
        # connection_string="DSN=VOS;UID=dba;PWD=dba"
    
        return pyodbc.connect(dsn_string, autocommit=True, readonly=readonly)
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 but lacks details on permissions, rate limits, error handling, or what 'connected database' entails. This is a significant gap for a tool that interacts with a database, making it inadequate for safe and effective use.

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 that directly states the tool's purpose without any fluff. It's appropriately sized and front-loaded, making it easy 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 complexity of database operations, no annotations, no output schema, and 0% schema description coverage, the description is incomplete. It fails to address critical aspects like return format, error cases, or connection requirements, which are essential for an AI agent to use this tool reliably.

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 adds no information about the single parameter 'url', and schema description coverage is 0%, leaving the parameter undocumented. However, with only one parameter and a baseline of 3 for minimal coverage, the score reflects that the description doesn't compensate but doesn't worsen the gap significantly.

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 ('Retrieve and return') and resource ('list of all schema names from the connected database'), making the purpose specific and understandable. It doesn't explicitly differentiate from sibling tools like 'podbc_get_tables' or 'podbc_filter_table_names', which might retrieve different database objects, so it misses the highest score.

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?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites like needing a database connection, nor does it compare to siblings such as 'podbc_get_tables' for table-level retrieval, leaving the agent without context for selection.

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/OpenLinkSoftware/mcp-sqlalchemy-server'

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