Skip to main content
Glama
OpenSIPS

OpenSIPS MCP Server

Official
by OpenSIPS

address_remove

Delete an address or permissions entry using its ID. Optionally reload the address table to apply changes immediately.

Instructions

Remove an address/permissions entry by ID. Optionally triggers MI address_reload.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
reloadNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The address_remove MCP tool handler. Decorated with @mcp.tool(), @audited('address_remove'), and @require_permission('db.write'). Accepts an address ID and optional reload flag. Calls crud.delete_address() to remove the entry, and optionally triggers MI address_reload.
    @mcp.tool()
    @audited("address_remove")
    @require_permission("db.write")
    async def address_remove(
        ctx: Context,
        id: int,
        reload: bool = True,
    ) -> dict[str, Any]:
        """Remove an address/permissions entry by ID. Optionally triggers MI address_reload."""
        from opensips_mcp.db.crud import address as crud
    
        app = ctx.request_context.lifespan_context
        async with app.db_session_factory() as session:
            deleted = await crud.delete_address(session, id)
        if not deleted:
            return {"error": "Address not found", "deleted": False}
    
        result: dict[str, Any] = {"id": id, "deleted": True}
        if reload:
            try:
                await app.mi_client.execute("address_reload")
                result["reloaded"] = True
            except Exception as exc:
                logger.warning("address_reload failed: %s", exc)
                result["reloaded"] = False
                result["reload_error"] = str(exc)
        return result
  • The @mcp.tool() decorator on address_remove registers it as an MCP tool with the framework.
    @mcp.tool()
  • The delete_address CRUD function that performs the actual database deletion of an address record by ID using SQLAlchemy.
    async def delete_address(session: AsyncSession, id: int) -> bool:
        stmt = delete(Address).where(Address.id == id)
        result = await session.execute(stmt)
        await session.commit()
        return result.rowcount > 0
  • The Address SQLAlchemy model representing the 'address' database table with columns: id, grp, ip, mask, port, proto, pattern, context_info.
    class Address(Base):
        __tablename__ = "address"
    
        id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
        grp: Mapped[int] = mapped_column(Integer, default=1)
        ip: Mapped[str] = mapped_column(String(50), nullable=False)
        mask: Mapped[int] = mapped_column(Integer, default=32)
        port: Mapped[int] = mapped_column(Integer, default=0)
        proto: Mapped[str] = mapped_column(String(8), default="any")
        pattern: Mapped[str | None] = mapped_column(String(64), nullable=True)
        context_info: Mapped[str | None] = mapped_column(String(64), nullable=True)
  • The import statement in server.py that triggers registration of all permissions tools (including address_remove) by importing the module.
    from opensips_mcp.tools import permissions_tools as _permissions_tools  # noqa: E402, F401
Behavior2/5

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

The description discloses that it removes an entry and optionally triggers a reload, but does not disclose side effects, permission requirements, or what happens if the ID is invalid.

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

Conciseness5/5

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

One sentence that is front-loaded with the core action, no wasted words.

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?

The tool is simple but the description does not cover return values (despite an output schema) or error cases, leaving gaps for the agent.

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

Parameters2/5

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

With 0% schema coverage, the description should explain both parameters fully. It implies id is the identifier and reload triggers reload, but lacks detail on the ID's meaning or reload's effect.

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 clearly states the action (remove) and the resource (address/permissions entry) via ID, and distinguishes from sibling tools like address_add and address_list.

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 mention of prerequisites or when the reload option is appropriate.

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