Skip to main content
Glama
victor-velazquez-ai

Enterprise MCP Template

execute_query

Execute queries against enterprise APIs like Salesforce or NetSuite using languages such as SOQL or SuiteQL. Retrieve structured data with pagination and authentication support.

Instructions

Execute a query against the upstream API.

TEMPLATE: Replace with your API's query language documentation. Examples: SuiteQL (NetSuite), SOQL (Salesforce), GraphQL, OData, etc.

Args: query: Query string in the upstream API's query language. account_id: Account ID (required if not configured on server). base_url: Optional full API URL (overrides account_id). limit: Maximum number of results. offset: Starting offset for pagination.

Returns: Structured response with query results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
account_idNo
base_urlNo
limitNo
offsetNo

Implementation Reference

  • The implementation of the `execute_query` tool, which is an asynchronous function decorated with `@mcp.tool()`. It uses an API client to run the query and returns the serialized response.
    async def execute_query(
        query: str,
        account_id: Optional[str] = None,
        base_url: Optional[str] = None,
        limit: Optional[int] = None,
        offset: Optional[int] = None,
    ) -> Dict[str, Any]:
        """
        Execute a query against the upstream API.
    
        TEMPLATE: Replace with your API's query language documentation.
        Examples: SuiteQL (NetSuite), SOQL (Salesforce), GraphQL, OData, etc.
    
        Args:
            query: Query string in the upstream API's query language.
            account_id: Account ID (required if not configured on server).
            base_url: Optional full API URL (overrides account_id).
            limit: Maximum number of results.
            offset: Starting offset for pagination.
    
        Returns:
            Structured response with query results.
        """
        token = _get_oauth_token()
    
        async with _get_client(base_url, account_id) as client:
            response = await client.execute_query(
                access_token=token,
                query=query,
                limit=limit,
                offset=offset,
            )
            return _serialize_response(response)
  • Registration of the `execute_query` tool using the `@mcp.tool()` decorator in `server.py`.
    @mcp.tool()

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/victor-velazquez-ai/enterprise-mcp-template'

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