Skip to main content
Glama
anpy-j

MCP Oracle Server

by anpy-j

reqd_query

Retrieve data from Oracle databases using SELECT queries. Execute SQL commands to access and extract information directly from the database via the MCP Oracle Server.

Instructions

Execute SELECT queries to read data from the oracle database

Args:
    query (string): The SELECT query to execute

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler and registration for 'reqd_query'. Thin wrapper that calls oracle_tools.read_query with the provided SQL SELECT query.
    @mcp.tool()
    async def reqd_query(query: str) -> str:
        """Execute SELECT queries to read data from the oracle database
    
        Args:
            query (string): The SELECT query to execute
        """
        return await oracle_tools.read_query(query)
  • MCP tool handler and registration for 'reqd_query' in the JYSD CX Oracle server. Thin wrapper that calls oracle_tools.read_query with the provided SQL SELECT query.
    @mcp.tool()
    async def reqd_query(query: str) -> str:
        """Execute SELECT queries to read data from the oracle database
    
        Args:
            query (string): The SELECT query to execute
        """
        return await oracle_tools.read_query(query)
  • Core helper function implementing the database query execution using cx_Oracle. Validates SELECT only, fetches results as CSV with headers, handles NULLs, runs in thread for async compatibility.
    async def read_query(query: str) -> str:
        try:
            # Check if the query is a SELECT statement
            if not query.strip().upper().startswith('SELECT'):
                return "Error: Only SELECT statements are supported."
    
            # Run database operations in a separate thread
            def db_operation(query):
                with cx_Oracle.connect(connection_string) as conn:
                    cursor = conn.cursor()
                    cursor.execute(query)  # Execute query first
    
                    # Get column names after executing the query
                    columns = [col[0] for col in cursor.description]
                    result = [','.join(columns)]  # Add column headers
    
                    # Process each row
                    for row in cursor:
                        # Convert each value in the tuple to string
                        string_values = [
                            str(val) if val is not None else "NULL" for val in row]
                        result.append(','.join(string_values))
    
                    return '\n'.join(result)
    
            return await asyncio.to_thread(db_operation, query)
        except cx_Oracle.DatabaseError as e:
            print('Error occurred:', e)
            return str(e)
  • Core helper function implementing the database query execution using cx_Oracle (identical to the other server). Validates SELECT only, fetches results as CSV with headers, handles NULLs, runs in thread for async compatibility.
    async def read_query(query: str) -> str:
        try:
            # Check if the query is a SELECT statement
            if not query.strip().upper().startswith('SELECT'):
                return "Error: Only SELECT statements are supported."
    
            # Run database operations in a separate thread
            def db_operation(query):
                with cx_Oracle.connect(connection_string) as conn:
                    cursor = conn.cursor()
                    cursor.execute(query)  # Execute query first
    
                    # Get column names after executing the query
                    columns = [col[0] for col in cursor.description]
                    result = [','.join(columns)]  # Add column headers
    
                    # Process each row
                    for row in cursor:
                        # Convert each value in the tuple to string
                        string_values = [
                            str(val) if val is not None else "NULL" for val in row]
                        result.append(','.join(string_values))
    
                    return '\n'.join(result)
    
            return await asyncio.to_thread(db_operation, query)
        except cx_Oracle.DatabaseError as e:
            print('Error occurred:', e)
            return str(e)
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool is for reading data via SELECT queries, which implies it's non-destructive and likely read-only, but it doesn't confirm this or add context on permissions, rate limits, error handling, or output format. The description is minimal and lacks rich behavioral details needed for safe invocation.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, with the core purpose stated first. The two sentences are efficient, but the parameter documentation could be more integrated. There's no wasted text, though it might benefit from slightly more detail to enhance clarity without losing conciseness.

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

Completeness3/5

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

Given the tool's complexity (a database query tool with one parameter), the description is somewhat complete but has gaps. It explains the purpose and parameter semantics, and an output schema exists (which reduces the need to describe return values). However, without annotations and with minimal behavioral context, it doesn't fully prepare an agent for effective use, especially regarding error cases or performance considerations.

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 description adds meaningful context for the single parameter: 'query (string): The SELECT query to execute.' Since schema description coverage is 0% (the schema only provides a title and type), this compensates by explaining the parameter's purpose and constraint (it must be a SELECT query). However, it doesn't detail syntax, validation rules, or examples, leaving some gaps.

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 tool's purpose: 'Execute SELECT queries to read data from the oracle database.' It specifies the verb ('Execute'), resource ('SELECT queries'), and target ('oracle database'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'describe_table' or 'list_tables' beyond the query execution focus.

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. It mentions executing SELECT queries but doesn't specify scenarios where this is preferred over 'describe_table' or 'list_tables', nor does it discuss prerequisites, limitations, or exclusions. Usage is implied through the query type but not explicitly stated.

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/anpy-j/mcp-oracle'

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