Skip to main content
Glama
Teradata

Teradata MCP Server

Official
by Teradata

sec_userRoles

Retrieve assigned roles for a specific user in Teradata databases to manage access permissions and security analysis.

Instructions

Get roles assigned to 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 handler function that implements the core logic of the sec_userRoles tool. It executes a SQL query to fetch roles associated with the given user_name from Teradata's system views, processes the results into JSON format using helper utilities, and returns a structured response with metadata including the tool name.
    def handle_sec_userRoles(conn: TeradataConnection, user_name: str, *args, **kwargs):
        """
        Get roles assigned to a user.
    
        Arguments:
          user_name - user name to analyze
    
        Returns:
          ResponseType: formatted response with query results + metadata
        """
        logger.debug(f"Tool: handle_sec_userRoles: 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
                        r.RoleName,
                        r.CreatorName,
                        r.CreateTimeStamp,
                        Rm.Grantor,
                        Rm.WhenGranted,
                        Rm.DefaultRole,
                        Rm.WithAdmin
                    FROM DBC.RoleInfoV r
                    JOIN DBC.RoleMembersV Rm
                    ON r.RoleName = Rm.RoleName
                    WHERE r.RoleName LIKE  '%{user_name}%' (NOT CASESPECIFIC);""")
                data = rows_to_json(cur.description, rows.fetchall())
            metadata = {
                "tool_name": "sec_userRoles",
                "argument": user_name,
                "num_roles": len(data)
            }
            logger.debug(f"Tool: handle_sec_userRoles: metadata: {metadata}")
            return create_response(data, metadata)

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/Teradata/teradata-mcp-server'

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