Skip to main content
Glama

podbc_sparql_func

Query and process SPARQL-based data directly through SQLAlchemy connectivity, enabling integration with any DBMS accessible via SQLAlchemy.

Instructions

Call ???.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyNo
promptYes
urlNo

Implementation Reference

  • The main handler function `podbc_sparql_func` that connects to the database using pyodbc, executes the SQL command `select DEMO.DBA.OAI_SPARQL_FUNC(?, ?) as result` with the prompt and API key, and returns the result.
    def podbc_sparql_func(prompt: str, api_key:Optional[str]=None, user:Optional[str]=None, password:Optional[str]=None, dsn:Optional[str]=None) -> str: """ Call SPARQL AI func. Args: prompt (str): The prompt. api_key (str): optional. user (Optional[str]=None): Optional username. password (Optional[str]=None): Optional password. dsn (Optional[str]=None): Optional dsn name. Returns: str: Results data in JSON. """ try: _api_key = api_key if api_key is not None else API_KEY with get_connection(True, user, password, dsn) as conn: cursor = conn.cursor() cmd = f"select DEMO.DBA.OAI_SPARQL_FUNC(?, ?) as result" rs = cursor.execute(cmd, (prompt, _api_key,)).fetchone() return rs[0] except pyodbc.Error as e: logging.error(f"Error executing request") raise pyodbc.Error("Error executing request")
  • The `@mcp.tool` decorator registers the `podbc_sparql_func` tool, specifying its name and description.
    @mcp.tool( name="podbc_sparql_func", description="Tool to use the SPARQL AI support function" )
  • The tool function is included in the package's `__all__` list for easy import.
    "podbc_sparql_func",
  • The `podbc_sparql_func` function is imported from server.py in the package init for re-export.
    podbc_sparql_func,

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