Skip to main content
Glama
OpenSIPS

OpenSIPS MCP Server

Official
by OpenSIPS

avp_get

Retrieve the value of a global AVP by name from an OpenSIPS server. This tool accesses global-scope AVPs via MI; per-transaction AVPs are not available.

Instructions

Get an AVP value (global scope only — per-transaction AVPs are not MI-accessible).

Parameters

name: AVP name (e.g. $avp(my_var) — pass as my_var).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler that executes the avp_get MI command via the MI client, passing the AVP name as a parameter.
    @mcp.tool()
    @require_permission("mi.read")
    async def avp_get(ctx: Context, name: str) -> dict[str, Any]:
        """Get an AVP value (global scope only — per-transaction AVPs are not MI-accessible).
    
        Parameters
        ----------
        name:
            AVP name (e.g. ``$avp(my_var)`` — pass as ``my_var``).
        """
        app = ctx.request_context.lifespan_context
        return await app.mi_client.execute("avp_get", {"name": name})
  • The function signature and docstring define the input schema: a single 'name' parameter (str) representing the AVP name. Output is a dict.
    @mcp.tool()
    @require_permission("mi.read")
    async def avp_get(ctx: Context, name: str) -> dict[str, Any]:
        """Get an AVP value (global scope only — per-transaction AVPs are not MI-accessible).
    
        Parameters
        ----------
        name:
            AVP name (e.g. ``$avp(my_var)`` — pass as ``my_var``).
        """
        app = ctx.request_context.lifespan_context
        return await app.mi_client.execute("avp_get", {"name": name})
  • Registers 'avp_get' as an MI command in the 'avpops' module with a 'name' parameter, category 'avpops'.
    _r("avp_get", "avpops", "Get an AVP value", ["name"], category="avpops")
  • Imports the avpops_tools module, which triggers the @mcp.tool() decorator registration of avp_get.
    from opensips_mcp.tools import avpops_tools as _avpops_tools  # noqa: E402, F401
  • MIClient.execute() sends the JSON-RPC request. The avp_get handler calls this with method='avp_get' and params={'name': name}.
    async def execute(
        self,
        method: str,
        params: dict[str, Any] | list[Any] | None = None,
    ) -> dict[str, Any]:
        """Send a JSON-RPC 2.0 request to the MI endpoint.
    
        Returns the ``result`` field on success.  Raises an appropriate
        :class:`MIError` subclass on failure.
        """
        payload: dict[str, Any] = {
            "jsonrpc": "2.0",
            "method": method,
            "id": next(self._id_counter),
        }
        if params is not None:
            payload["params"] = params
    
        response_data = await self._send_with_retry(payload, method=method)
        return self._parse_response(response_data, method)
Behavior4/5

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

No annotations provided, so description carries full burden. It correctly describes a read-only operation with scope constraint, which is sufficient for a simple getter. No hidden side effects or auth needs disclosed, but likely unnecessary.

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?

Extremely concise: one sentence for purpose and one for parameter. No fluff, front-loaded with key info.

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

Completeness4/5

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

For a single-parameter getter with an output schema, the description sufficiently covers purpose, scope, and parameter format. Minor improvement could mention return value format, but output schema likely handles that.

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

Parameters5/5

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

Provides example format ('$avp(my_var)' -> 'my_var') which adds meaning beyond the schema's bare string type. This helps the agent format the parameter correctly.

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?

Clearly states 'Get an AVP value' with explicit scope ('global scope only'), which distinguishes it from sibling tools like avp_delete and avp_set that perform other operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit scope limitation (global only, not per-transaction) and notes that per-transaction AVPs are not MI-accessible, guiding when not to use. No explicit alternative mentioned, but implication is clear.

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