Skip to main content
Glama

sec_userDbPermissions

Retrieve database permissions for a specific user to understand access rights and security settings within 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 handler function that implements the core logic of the 'sec_userDbPermissions' tool. It queries the DBC.AllRightsV view to retrieve database, table, and column permissions for the specified user.
    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 of handler functions as MCP tools. Functions named 'handle_<tool_name>' are automatically registered as tools with the name '<tool_name>', including 'sec_userDbPermissions' from handle_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}")

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