Skip to main content
Glama
OpenSIPS

OpenSIPS MCP Server

Official
by OpenSIPS

cc_agent_login

Log a call center agent in or out by providing the agent ID and login state (1 for login, 0 for logout). Manage agent availability efficiently.

Instructions

Log a call center agent in or out.

Parameters

agent_id: The agent identifier (e.g. agent1). state: Login state: 1 to log in, 0 to log out.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYes
stateYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for cc_agent_login. Decorated with @mcp.tool() for registration, @audited for audit logging, and @require_permission("mi.write") for RBAC. Accepts agent_id (str) and state (int: 1=login, 0=logout), then dispatches the command via the MI client.
    @mcp.tool()
    @audited("cc_agent_login")
    @require_permission("mi.write")
    async def cc_agent_login(
        ctx: Context,
        agent_id: str,
        state: int,
    ) -> dict[str, Any]:
        """Log a call center agent in or out.
    
        Parameters
        ----------
        agent_id:
            The agent identifier (e.g. ``agent1``).
        state:
            Login state: 1 to log in, 0 to log out.
        """
        app = ctx.request_context.lifespan_context
        result = await app.mi_client.execute(
            "cc_agent_login",
            {"agent_id": agent_id, "state": str(state)},
        )
        return result
  • The tool module call_center_tools (containing cc_agent_login) is registered by importing it in server.py, which triggers the @mcp.tool() decorator and registers the handler with the FastMCP server instance.
    mcp = FastMCP("opensips-mcp-server", lifespan=app_lifespan)
  • MI command registry entry for cc_agent_login, defining its module (call_center), description, parameters (agent_id, state), permission (mi.write), and category.
    _r("cc_agent_login", "call_center", "Log a call center agent in or out", ["agent_id", "state"], "mi.write", "call_center")
  • The @audited decorator applied to cc_agent_login, which logs audit entries (with operation name, parameters, role, and success/error status) on each invocation.
    def audited(operation: str):
        """Decorator that logs audit entries for tool calls."""
    
        def decorator(func):
            @wraps(func)
            async def wrapper(ctx: Context, *args, **kwargs):
                app = ctx.request_context.lifespan_context
                role = getattr(app.settings, "role", "unknown")
                try:
                    result = await func(ctx, *args, **kwargs)
                    audit_log(operation, kwargs, "success", role)
                    return result
                except Exception as e:
                    audit_log(operation, kwargs, f"error: {e}", role)
                    raise
    
            return wrapper
    
        return decorator
  • The @require_permission decorator applied to cc_agent_login, which enforces that the active role has the 'mi.write' permission before allowing execution.
    def require_permission(permission: str) -> Callable[..., Any]:
        """Decorator that enforces RBAC on an MCP tool function.
    
        The decorated function **must** accept ``ctx: Context`` as its first
        positional argument.  The current role is read from
        ``ctx.request_context.lifespan_context.settings.role``.
    
        Raises ``McpError`` when the active role lacks the requested permission.
        """
    
        def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
            @functools.wraps(func)
            async def wrapper(ctx: Context, *args: Any, **kwargs: Any) -> Any:
                app_context = ctx.request_context.lifespan_context
                role_value: str = app_context.settings.role.lower()
    
                try:
                    role = Role(role_value)
                except ValueError:
                    raise McpError(
                        ErrorData(
                            code=-1,
                            message=f"Unknown role '{role_value}'. Valid roles: {[r.value for r in Role]}",
                        )
                    ) from None
    
                allowed = PERMISSIONS.get(role, set())
                if permission not in allowed:
                    raise McpError(
                        ErrorData(
                            code=-1,
                            message=f"Permission denied: role '{role.value}' lacks '{permission}' permission",
                        )
                    )
    
                return await func(ctx, *args, **kwargs)
    
            return wrapper
    
        return decorator
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the action (login/logout) without disclosing side effects, idempotency, prerequisites, or response behavior. The description does not contradict annotations as none exist.

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 succinct (one sentence plus parameter list) and front-loaded with the core action. It avoids redundancy but could be slightly more structured.

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

Completeness3/5

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

Given the tool's low complexity and presence of an output schema, the description adequately covers the parameters. However, missing context on return values, side effects, or prerequisites makes it only minimally complete.

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

Parameters4/5

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

The input schema has 0% description coverage, so the tool description compensates well by providing clear semantics: agent_id as an identifier example, and state as numeric 1/0 for login/logout. This adds meaning beyond the schema's titles.

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

Purpose5/5

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

The description explicitly states 'Log a call center agent in or out,' clearly defining the verb and resource. It distinguishes from sibling tools like cc_list_agents or cc_list_queue, which focus on listing rather than changing agent state.

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 on when to use this tool versus alternatives, no prerequisites, and no scenarios where login vs logout is appropriate. Only basic parameter values provided.

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

Install Server

Other Tools

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/OpenSIPS/opensips-mcp-server'

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