Skip to main content
Glama
blitzstermayank

Teradata MCP Server

sec_userDbPermissions

Retrieve database permissions for a specified user to analyze access rights and security settings in Teradata systems.

Instructions

Get permissions for a user.

Arguments: user_name - user name to analyze

Returns: ResponseType: formatted response with query results + metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_nameYes

Implementation Reference

  • The main handler function that implements the logic for the sec_userDbPermissions tool. It executes a SQL query against DBC.AllRightsV to fetch permissions for the given user_name and returns formatted results with metadata.
    def handle_sec_userDbPermissions(conn: TeradataConnection, user_name: str, *args, **kwargs):
        """
        Get permissions for a user.
    
        Arguments:
          user_name - user name to analyze
    
        Returns:
          ResponseType: formatted response with query results + metadata
        """
        logger.debug(f"Tool: handle_sec_userDbPermissions: Args: user_name: {user_name}")
    
        with conn.cursor() as cur:
            if user_name == "":
                logger.debug("No user_name argument provided")
                data = rows_to_json(None, [])
            else:
                logger.debug(f"Argument provided: {user_name}")
                rows = cur.execute(f"""
                    SELECT
                        DatabaseName,
                        TableName,
                        ColumnName,
                        AccessRight,
                        GrantAuthority,
                        GrantorName
                    FROM DBC.AllRightsV
                    WHERE UserName = '{user_name}'
                    ORDER BY DatabaseName, TableName, AccessRight;""")
                data = rows_to_json(cur.description, rows.fetchall())
            metadata = {
                "tool_name": "sec_userDbPermissions",
                "argument": user_name,
                "num_permissions": len(data)
            }
            logger.debug(f"Tool: handle_sec_userDbPermissions: metadata: {metadata}")
            return create_response(data, metadata)
  • Dynamic registration code that discovers handle_* functions (including handle_sec_userDbPermissions) via module loader and registers them as MCP tools with the name derived from the function name (sec_userDbPermissions).
    module_loader = td.initialize_module_loader(config)
    if module_loader:
        all_functions = module_loader.get_all_functions()
        for name, func in all_functions.items():
            if not (inspect.isfunction(func) and name.startswith("handle_")):
                continue
            tool_name = name[len("handle_"):]
            if not any(re.match(p, tool_name) for p in config.get('tool', [])):
                continue
            wrapped = make_tool_wrapper(func)
            mcp.tool(name=tool_name, description=wrapped.__doc__)(wrapped)
            logger.info(f"Created tool: {tool_name}")
  • Imports the sec_tools (containing the handler) making it available for dynamic loading by the module_loader.
    from .sec_resources import *
    from .sec_tools import *

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/blitzstermayank/MCP'

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