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 *

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It only states 'Get permissions' without revealing side effects, authorization needs, or potential impacts. The return type is vaguely described as 'formatted response with query results + metadata'.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with a clear structure: purpose, arguments, returns. Every sentence serves a purpose, and it is front-loaded with the main action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the low complexity (1 parameter, no output schema) and lack of sibling differentiation, the description is incomplete. It does not clarify the scope of permissions (e.g., database-level, table-level) or the format of results, leaving significant gaps for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description includes a brief parameter line 'user_name - user name to analyze', which adds some meaning beyond the schema's type and required status. However, the schema description coverage is 0% and the parameter description is minimal.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Get permissions for a user', which is a specific verb and resource. However, it does not differentiate from sibling tools like sec_rolePermissions or sec_userRoles, leaving ambiguity about what type of permissions are retrieved.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. There is no mention of prerequisites, context, or exclusion criteria, leaving the agent without decision support.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.