Skip to main content
Glama
MarioDeFelipe

SAP Datasphere MCP Server

execute_query

Retrieve and analyze data from SAP Datasphere tables using read-only SQL queries. Filter, join, and aggregate results with a default limit of 100 rows.

Instructions

Execute read-only SQL queries against SAP Datasphere tables to retrieve and analyze data.

IMPORTANT: This is a HIGH-RISK tool that requires user consent before execution.

Use this tool when:

  • User explicitly requests data retrieval (e.g., "Show me customers from USA")

  • Need to perform data analysis with aggregations

  • Joining multiple tables for insights

  • Filtering and sorting data

Capabilities:

  • SELECT queries with full SQL syntax (WHERE, JOIN, GROUP BY, ORDER BY, LIMIT)

  • Read-only access - NO write operations allowed

  • Results limited to 100 rows by default (configurable via limit parameter)

  • Automatic query sanitization and injection prevention

Security & Restrictions:

  • Only SELECT statements allowed

  • Blocked operations: INSERT, UPDATE, DELETE, DROP, CREATE, ALTER, etc.

  • No SQL comments allowed (security risk)

  • Queries sanitized to prevent injection attacks

  • User consent required before execution (high-risk operation)

Query best practices:

  1. Always specify a LIMIT to control result size

  2. Use WHERE clauses to filter data efficiently

  3. Check table schema first with get_table_schema()

  4. Use qualified table names when joining

Example queries:

  • "SELECT * FROM CUSTOMER_DATA WHERE country = 'USA' LIMIT 10"

  • "SELECT customer_id, SUM(amount) as total FROM SALES_ORDERS GROUP BY customer_id ORDER BY total DESC LIMIT 20"

  • "SELECT c.customer_name, o.order_date, o.amount FROM CUSTOMER_DATA c JOIN SALES_ORDERS o ON c.customer_id = o.customer_id WHERE o.status = 'COMPLETED' LIMIT 50"

Error handling:

  • Invalid SQL syntax: Returns syntax error with guidance

  • Forbidden operations: Blocked with explanation

  • Missing tables: Suggests using search_tables() to find correct name

  • Permission denied: Explains consent requirement

Note: This tool uses mock data in development. Real query execution requires OAuth authentication.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
space_idYesThe Datasphere space ID where tables exist (e.g., 'SALES_ANALYTICS', 'FINANCE_DWH'). Must be uppercase.
sql_queryYesThe SELECT query to execute. Must start with SELECT. Examples: 'SELECT * FROM CUSTOMER_DATA LIMIT 10', 'SELECT customer_id, COUNT(*) FROM SALES_ORDERS GROUP BY customer_id'
limitNoMaximum number of rows to return. Default: 100. Range: 1-1000. Use smaller limits for faster responses.
Behavior5/5

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

With no annotations provided, the description fully discloses behavior: read-only, high-risk requiring user consent, query sanitization, row limits, and development mock data. Error handling details are also included.

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?

Well-structured with clear sections and front-loaded critical warnings. However, it is somewhat lengthy and contains some redundancy (e.g., read-only mentioned multiple times). For a high-risk tool, the length is acceptable.

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

Completeness5/5

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

Given the absence of an output schema and 3 parameters, the description covers behavior, security, best practices, examples, and error handling exceptionally well. It addresses prerequisites and provides actionable guidance for an agent.

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?

Schema coverage is 100%, so baseline is 3. The description adds value with example queries for sql_query, clarifies space_id context (uppercase), and explains limit defaults and range. This goes slightly beyond schema but doesn't introduce new semantics.

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

Purpose5/5

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

The description clearly states the tool executes read-only SQL queries against SAP Datasphere tables, with specific verb and resource. It distinguishes from sibling tools like analyze_column_distribution and smart_query by emphasizing generic SQL execution and high-risk operations requiring consent.

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

Usage Guidelines5/5

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

Explicitly lists scenarios when to use (data retrieval, aggregation, joins) and provides best practices for query construction. Although it doesn't mention alternatives, the guidelines are comprehensive and include error handling guidance.

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/MarioDeFelipe/sap-datasphere-mcp'

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