avp_delete
Delete a global AVP to remove it from the OpenSIPS configuration, helping you manage and clean up unnecessary attribute-value pairs.
Instructions
Delete a global AVP.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The MCP tool handler for 'avp_delete'. It is registered with @mcp.tool(), decorated with @audited('avp_delete') for audit logging, and @require_permission('mi.write') for RBAC. It sends an MI command 'avp_delete' with the AVP name to the OpenSIPS server via the MI client.
@mcp.tool() @audited("avp_delete") @require_permission("mi.write") async def avp_delete(ctx: Context, name: str) -> dict[str, Any]: """Delete a global AVP.""" app = ctx.request_context.lifespan_context return await app.mi_client.execute("avp_delete", {"name": name}) - Registration of the 'avp_delete' MI command in the command registry. Declares the command belongs to the 'avpops' module, accepts a 'name' parameter, requires 'mi.write' permission, and is categorized under 'avpops'.
_r("avp_delete", "avpops", "Delete an AVP", ["name"], "mi.write", "avpops") - src/opensips_mcp/server.py:162-162 (registration)The avpops_tools module (containing avp_delete) is imported in server.py, which causes the @mcp.tool() decorator to register avp_delete with the FastMCP server instance.
from opensips_mcp.tools import avpops_tools as _avpops_tools # noqa: E402, F401 - The @audited decorator wraps avp_delete to log audit entries (operation name, params, result status, role) on every 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 - src/opensips_mcp/cfg/migration_rules.py:137-137 (registration)The 'avp_delete' entry in migration rules for 2.4→3.0. Lists the avp_delete script function as deprecated, recommending 'unset($avp(name))' instead. This is a config migration reference, not the MCP tool.
"avp_delete": None, # deprecated, prefer unset($avp(name))