Skip to main content
Glama
OpenSIPS

OpenSIPS MCP Server

Official
by OpenSIPS

drouting_list_gateways

Retrieve a list of dynamic routing gateways from OpenSIPS. Supports pagination with limit and offset parameters to control result size.

Instructions

List dynamic routing gateways.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
offsetNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main MCP tool handler for 'drouting_list_gateways'. It is decorated with @mcp.tool() and @require_permission('db.read'). It accepts limit/offset parameters, queries gateways via the CRUD layer, and returns a list of gateway dicts with fields: gwid, type, address, strip, pri_prefix, attrs, probe_mode, state, socket, description, plus a count.
    @mcp.tool()
    @require_permission("db.read")
    async def drouting_list_gateways(
        ctx: Context,
        limit: int = 100,
        offset: int = 0,
    ) -> dict[str, Any]:
        """List dynamic routing gateways."""
        from opensips_mcp.db.crud import drouting as crud
    
        app = ctx.request_context.lifespan_context
        async with app.db_session_factory() as session:
            gateways = await crud.list_gateways(session, limit=limit, offset=offset)
            return {
                "gateways": [
                    {
                        "gwid": g.gwid,
                        "type": g.type,
                        "address": g.address,
                        "strip": g.strip,
                        "pri_prefix": g.pri_prefix,
                        "attrs": g.attrs,
                        "probe_mode": g.probe_mode,
                        "state": g.state,
                        "socket": g.socket,
                        "description": g.description,
                    }
                    for g in gateways
                ],
                "count": len(gateways),
            }
  • The DRGateway SQLAlchemy model (schema) that defines the structure of the dr_gateways table. Fields: gwid, type, address, strip, pri_prefix, attrs, probe_mode, state, socket, description.
    class DRGateway(Base):
        __tablename__ = "dr_gateways"
    
        gwid: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
        type: Mapped[int] = mapped_column(Integer, default=0)
        address: Mapped[str] = mapped_column(String(128), nullable=False)
        strip: Mapped[int] = mapped_column(Integer, default=0)
        pri_prefix: Mapped[str] = mapped_column(String(64), default="")
        attrs: Mapped[str] = mapped_column(String(255), default="")
        probe_mode: Mapped[int] = mapped_column(Integer, default=0)
        state: Mapped[int] = mapped_column(Integer, default=0)
        socket: Mapped[str] = mapped_column(String(128), default="")
        description: Mapped[str] = mapped_column(String(128), default="")
  • The CRUD helper function 'list_gateways' that executes the actual SQLAlchemy SELECT query on the DRGateway model with limit/offset pagination.
    async def list_gateways(
        session: AsyncSession,
        limit: int = 100,
        offset: int = 0,
    ) -> list[DRGateway]:
        stmt = select(DRGateway).limit(limit).offset(offset)
        result = await session.execute(stmt)
        return list(result.scalars().all())
  • The @mcp.tool() decorator registers this function as an MCP tool named 'drouting_list_gateways' (the function name becomes the tool name).
    @mcp.tool()
  • A resource docstring that references the drouting_list_gateways tool, telling users to use it to query gateways from the database.
    "usage": (
        "Use the drouting_list_gateways tool to query gateways "
        "from the database. Gateways are referenced by gwid in "
        "the dr_rules gwlist column."
    ),
Behavior2/5

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

With no annotations, the description bears full burden. It lacks details on pagination behavior (limit/offset), whether list is sorted, or any side effects, leaving the agent uninformed.

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?

The description is extremely concise with no extraneous information, using the minimum words to convey the tool's core purpose.

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?

Despite having an output schema, the description fails to clarify return format or default behavior; the minimalism leaves significant gaps for a straightforward list tool.

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

Parameters1/5

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

Schema description coverage is 0%, yet the description provides no explanation of parameters (limit, offset) or their meanings, requiring the agent to infer solely from the schema.

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 'List dynamic routing gateways' clearly states a specific verb and resource, and given sibling tools like drouting_list_carriers and drouting_list_rules, it effectively distinguishes its function.

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, such as drouting_list_carriers or drouting_list_rules, nor are there any use-case exclusions.

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