registrar_stats
Fetch registration counts, expiry statistics, and related counters from OpenSIPS registrar and usrloc modules to monitor registrar performance and user activity.
Instructions
Retrieve registrar-related statistics.
Returns registration counts, expiry stats, and related counters from the OpenSIPS registrar and usrloc modules.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "registrar_stats"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function for the 'registrar_stats' tool. It uses the MCP tool decorator, RBAC permission 'mi.read', and executes a 'get_statistics' MI command for 'registrar:' and 'usrloc:' statistics.
@mcp.tool() @require_permission("mi.read") async def registrar_stats(ctx: Context) -> dict[str, Any]: """Retrieve registrar-related statistics. Returns registration counts, expiry stats, and related counters from the OpenSIPS registrar and usrloc modules. """ app = ctx.request_context.lifespan_context result = await app.mi_client.execute( "get_statistics", {"statistics": ["registrar:", "usrloc:"]}, ) return result - src/opensips_mcp/server.py:197-197 (registration)The import that registers the registrar_tools module (containing the registrar_stats tool) with the MCP server.
from opensips_mcp.tools import registrar_tools as _registrar_tools # noqa: E402, F401 - The RBAC permission decorator 'mi.read' applied to the registrar_stats tool, enforcing access control.
@mcp.tool() @require_permission("mi.read") async def registrar_stats(ctx: Context) -> dict[str, Any]: """Retrieve registrar-related statistics. Returns registration counts, expiry stats, and related counters from the OpenSIPS registrar and usrloc modules. """ app = ctx.request_context.lifespan_context result = await app.mi_client.execute( "get_statistics", {"statistics": ["registrar:", "usrloc:"]}, ) return result