Skip to main content
Glama
DimiDR

SAP Datasphere MCP Server

by DimiDR

execute_query

Query SAP Datasphere tables with read-only SQL to retrieve, filter, aggregate, and join data for analysis.

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
limitNoMaximum number of rows to return. Default: 100. Range: 1-1000. Use smaller limits for faster responses.
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'
Behavior5/5

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

No annotations are provided, so the description carries full burden. It discloses critical behaviors: read-only access, blocked operations (INSERT, UPDATE, etc.), no SQL comments, query sanitization, user consent requirement, default row limit, and mock-data/OAuth notes. It even labels itself 'HIGH-RISK', providing strong transparency.

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 well-structured with headers, bullet points, and front-loaded purpose and risk warnings. It is verbose and contains some redundancy (e.g., 'no write operations' repeated, 'user consent' mentioned twice), but each section adds useful information. Slightly over-long but organized enough to earn a 4.

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

Completeness4/5

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

Given the complexity (SQL execution, security restrictions), the description covers use cases, capabilities, security rules, best practices, examples, error handling, and environment-specific notes. However, with no output schema, it does not explicitly describe the exact response format (e.g., array of objects), leaving a minor gap in completeness.

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?

All three parameters have rich descriptions in the input schema, covering defaults, ranges, case requirements, and syntax examples. The tool description adds examples and best practices but does not introduce new parameter semantics beyond what the schema already provides. Baseline of 3 is appropriate due to 100% schema coverage.

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 opens with a specific verb and resource: 'Execute read-only SQL queries against SAP Datasphere tables to retrieve and analyze data.' It clearly states the tool's purpose and scope (read-only SQL on tables), distinguishing it from siblings like query_analytical_data or query_relational_entity. Examples further reinforce the SELECT-only nature.

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

Usage Guidelines4/5

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

The description includes a dedicated 'Use this tool when:' section with explicit scenarios (data retrieval, aggregations, joins, filtering). It also suggests checking table schema with get_table_schema() and mentions using search_tables() for missing tables. However, it does not explicitly name alternative tools or provide 'when not to use' exclusions, which prevents a 5.

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/DimiDR/SAP-Datasphere-MCP'

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