podbc_virtuoso_support_ai
Leverage AI support in Virtuoso via MCP’s SQLAlchemy integration to process prompts and enhance database interactions.
Instructions
Tool to use the Virtuoso AI support function
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"prompt": "<prompt>"
},
"name": "podbc_virtuoso_support_ai"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_key | No | ||
| prompt | Yes | ||
| url | No |
Implementation Reference
- mcp_sqlalchemy_server/server.py:445-474 (handler)The handler function decorated with @mcp.tool, which registers and implements the 'podbc_virtuoso_support_ai' tool. It connects to the database via pyodbc, executes the Virtuoso AI support SQL function with the prompt and API key, and returns the result.
@mcp.tool( name="podbc_virtuoso_support_ai", description="Tool to use the Virtuoso AI support function" ) def podbc_virtuoso_support_ai(prompt: str, api_key:Optional[str]=None, user:Optional[str]=None, password:Optional[str]=None, dsn:Optional[str]=None) -> str: """ Tool to use the Virtuoso AI support function Args: prompt (str): AI prompt text (required). api_key (str): API key for AI service (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_VIRTUOSO_SUPPORT_AI(?, ?) 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") - mcp_sqlalchemy_server/server.py:445-448 (registration)The @mcp.tool decorator registers the tool with name 'podbc_virtuoso_support_ai' and its description.
@mcp.tool( name="podbc_virtuoso_support_ai", description="Tool to use the Virtuoso AI support function" )