Skip to main content
Glama
UserAd

didlogic_mcp

update_sip_account

Update SIP account details, including caller ID, call restrictions, IP allowlisting, and number rewriting rules, to manage call settings and security.

Instructions

Creates a SIP account

Args: name: SIP account name password: Password to be used for this SIP account callerid: CallerID associated with this SIP account label: label fot this SIP account rewrite_enabled: do SIP account have calling number rewriting rule rewrite_cond: prefix to be rewrited (ex: 00) rewrite_prefix: prefix to what should be rewritten (ex: 44) didinfo_enabled: do DIDLogic will attempt send DID number as TO when receiving calls to this account ip_restrict: do we need to allowlist IP addresses for this account call_restrict: flag indicates what SIP account should have maximum call time call_limit: maximum call duration in seconds channels_restrict: flag indicates what SIP account should have maximum channels limit max_channels: maximum sip channels cost_limit: flag indicates what SIP account should have maximum call cost max_call_cost: maximum call cost for this SIP account

Returns a JSON object with SIP account details where: id: ID of SIP account name: SIP account name (login) callerid: CallerID associated with this SIP account label: label fot this SIP account charge: charge for calls on this month talk_time: total talk time for this month rewrite_enabled: do SIP account have calling number rewriting rule rewrite_cond: prefix to be rewrited (ex: 00) rewrite_prefix: prefix to what should be rewritten (ex: 44) didinfo_enabled: do DIDLogic will attempt send DID number as TO when receiving calls to this account ip_restrict: do we need to allowlist IP addresses for this account allowed_ips: IP addresses allowed for this SIP account call_restrict: flag indicates what SIP account should have maximum call time call_limit: maximum call duration in seconds channels_restrict: flag indicates what SIP account should have maximum channels limit max_channels: maximum sip channels cost_limit: flag indicates what SIP account should have maximum call cost max_call_cost: maximum call cost for this SIP account created_at: date of creation this SIP account

Example:

{
    "sipaccount": {
        "id": 61,
        "name": "12345",
        "callerid": "17254999999",
        "label": "TEST DEVICE",
        "host": "dynamic",
        "charge": "0.0",
        "talk_time": 0,
        "rewrite_enabled": false,
        "rewrite_cond": "8",
        "rewrite_prefix": "7",
        "didinfo_enabled": false,
        "ip_restrict": false,
        "call_restrict": true,
        "call_limit": 2800,
        "channels_restrict": false,
        "max_channels": 1,
        "cost_limit": false,
        "max_call_cost": "5.0",
        "created_at": "2024-06-03 06:06:47 UTC",
        "allowed_ips": ["1.2.3.4", "3.4.5.6"]
    }
}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
call_limitNoMaximum call duration for SIP account in seconds
call_restrictNoEnable call duration limit for SIP account
calleridNoCallerid for use with this SIP account
channels_restrictNoEnable concurrent calls limit
cost_limitNoEnable maximum call cost for SIP account
didinfo_enabledNoEnable DID number in inbound calls
ip_restrictNoEnable IP restriction for SIP account
labelNoLabel for SIP account
max_call_costNoMaximum call cost for SIP account
max_channelsNoCount of concurrent calls limit
nameYesSIP Account name
passwordNoPassword for SIP account
rewrite_condNoPrefix to remove from number
rewrite_enabledNoEnable number rewriting for calls
rewrite_prefixNoPrefix to add to number

Implementation Reference

  • The core handler function for the 'update_sip_account' tool. It uses Pydantic Field for input schema validation, constructs a data dictionary from optional parameters, and performs a PUT request to the Didlogic API endpoint '/v1/sipaccounts/{name}' using the base helper.
    @mcp.tool()
    async def update_sip_account(
        ctx: Context,
        name: str | int = Field(description="SIP Account name"),
        password: Optional[str] = Field(
            description="Password for SIP account", default=None
        ),
        callerid: Optional[str | int] = Field(
            description="Callerid for use with this SIP account", default=None
        ),
        label: Optional[str] = Field(
            description="Label for SIP account", default=None
        ),
        rewrite_enabled: Optional[bool] = Field(
            description="Enable number rewriting for calls", default=None
        ),
        rewrite_cond: Optional[str] = Field(
            description="Prefix to remove from number", default=None
        ),
        rewrite_prefix: Optional[str] = Field(
            description="Prefix to add to number", default=None
        ),
        didinfo_enabled: Optional[bool] = Field(
            description="Enable DID number in inbound calls", default=None
        ),
        ip_restrict: Optional[bool] = Field(
            description="Enable IP restriction for SIP account", default=None
        ),
        call_restrict: Optional[bool] = Field(
            description="Enable call duration limit for SIP account",
            default=None
        ),
        call_limit: Optional[int] = Field(
            description="Maximum call duration for SIP account in seconds",
            default=None
        ),
        channels_restrict: Optional[bool] = Field(
            description="Enable concurrent calls limit", default=None
        ),
        max_channels: Optional[int] = Field(
            description="Count of concurrent calls limit", default=None
        ),
        cost_limit: Optional[bool] = Field(
            description="Enable maximum call cost for SIP account",
            default=None
        ),
        max_call_cost: Optional[float] = Field(
            description="Maximum call cost for SIP account", default=None
        )
    ) -> str:
        """
            Creates a SIP account
    
            Args:
                name: SIP account name
                password: Password to be used for this SIP account
                callerid: CallerID associated with this SIP account
                label: label fot this SIP account
                rewrite_enabled: do SIP account have calling number rewriting rule
                rewrite_cond: prefix to be rewrited (ex: 00)
                rewrite_prefix: prefix to what should be rewritten (ex: 44)
                didinfo_enabled: do DIDLogic will attempt send DID number as TO when receiving calls to this account
                ip_restrict: do we need to allowlist IP addresses for this account
                call_restrict: flag indicates what SIP account should have maximum call time
                call_limit: maximum call duration in seconds
                channels_restrict: flag indicates what SIP account should have maximum channels limit
                max_channels: maximum sip channels
                cost_limit: flag indicates what SIP account should have maximum call cost
                max_call_cost: maximum call cost for this SIP account
    
    
            Returns a JSON object with SIP account details where:
                id: ID of SIP account
                name: SIP account name (login)
                callerid: CallerID associated with this SIP account
                label: label fot this SIP account
                charge: charge for calls on this month
                talk_time: total talk time for this month
                rewrite_enabled: do SIP account have calling number rewriting rule
                rewrite_cond: prefix to be rewrited (ex: 00)
                rewrite_prefix: prefix to what should be rewritten (ex: 44)
                didinfo_enabled: do DIDLogic will attempt send DID number as TO when receiving calls to this account
                ip_restrict: do we need to allowlist IP addresses for this account
                allowed_ips: IP addresses allowed for this SIP account
                call_restrict: flag indicates what SIP account should have maximum call time
                call_limit: maximum call duration in seconds
                channels_restrict: flag indicates what SIP account should have maximum channels limit
                max_channels: maximum sip channels
                cost_limit: flag indicates what SIP account should have maximum call cost
                max_call_cost: maximum call cost for this SIP account
                created_at: date of creation this SIP account
    
            Example:
            ```
            {
                "sipaccount": {
                    "id": 61,
                    "name": "12345",
                    "callerid": "17254999999",
                    "label": "TEST DEVICE",
                    "host": "dynamic",
                    "charge": "0.0",
                    "talk_time": 0,
                    "rewrite_enabled": false,
                    "rewrite_cond": "8",
                    "rewrite_prefix": "7",
                    "didinfo_enabled": false,
                    "ip_restrict": false,
                    "call_restrict": true,
                    "call_limit": 2800,
                    "channels_restrict": false,
                    "max_channels": 1,
                    "cost_limit": false,
                    "max_call_cost": "5.0",
                    "created_at": "2024-06-03 06:06:47 UTC",
                    "allowed_ips": ["1.2.3.4", "3.4.5.6"]
                }
            }
            ```
        """
        data = {}
    
        # Add all provided parameters
        if password is not None:
            data["sipaccount[password]"] = password
        if callerid is not None:
            data["sipaccount[callerid]"] = callerid
        if label is not None:
            data["sipaccount[label]"] = label
        if rewrite_enabled is not None:
            data["sipaccount[rewrite_enabled]"] = int(rewrite_enabled)
        if rewrite_cond is not None:
            data["sipaccount[rewrite_cond]"] = rewrite_cond
        if rewrite_prefix is not None:
            data["sipaccount[rewrite_prefix]"] = rewrite_prefix
        if didinfo_enabled is not None:
            data["sipaccount[didinfo_enabled]"] = int(didinfo_enabled)
        if ip_restrict is not None:
            data["sipaccount[ip_restrict]"] = int(ip_restrict)
        if call_restrict is not None:
            data["sipaccount[call_restrict]"] = int(call_restrict)
        if call_limit is not None:
            data["sipaccount[call_limit]"] = call_limit
        if channels_restrict is not None:
            data["sipaccount[channels_restrict]"] = int(channels_restrict)
        if max_channels is not None:
            data["sipaccount[max_channels]"] = max_channels
        if cost_limit is not None:
            data["sipaccount[cost_limit]"] = int(cost_limit)
        if max_call_cost is not None:
            data["sipaccount[max_call_cost]"] = max_call_cost
    
        response = await base.call_didlogic_api(
            ctx, "PUT", f"/v1/sipaccounts/{name}", data=data
        )
        return response.text
  • Server-wide registration of tool modules, including sip_accounts.register_tools(mcp) which defines and registers the update_sip_account tool via @mcp.tool() decorators.
    tools.balance.register_tools(mcp)
    tools.sip_accounts.register_tools(mcp)
    tools.allowed_ips.register_tools(mcp)
    tools.purchases.register_tools(mcp)
    tools.purchase.register_tools(mcp)
    tools.calls.register_tools(mcp)
    tools.transactions.register_tools(mcp)
  • Shared helper utility function called by the handler to perform authenticated HTTP requests to the Didlogic API, handling API key from context in both STDIO and HTTP modes.
    async def call_didlogic_api(
        ctx: Context,
        method: str,
        path: str,
        params: Optional[Dict] = None,
        data: Optional[Dict] = None,
        json: Optional[Dict] = None
    ) -> httpx.Response:
        """
        Make a call to the Didlogic API.
    
        In HTTP/SSE mode, extracts Bearer token from request context and adds it
        to the Authorization header for each API call.
        In STDIO mode, uses the API key already configured in the client headers.
        """
        client = ctx.request_context.lifespan_context.client
    
        # In HTTP/SSE mode, get API key from request.state (set by middleware)
        extra_headers = {}
    
        # Check if we have a request object (indicates HTTP/SSE mode)
        request = getattr(ctx.request_context, "request", None)
    
        if request and hasattr(request, 'state') and hasattr(request.state, 'didlogic_api_key'):
            # HTTP/SSE mode: extract API key from request state
            api_key = request.state.didlogic_api_key
            if api_key:
                extra_headers["Authorization"] = f"Bearer {api_key}"
                logger.debug(f"Using API key from request state: {api_key[:8]}...")
            else:
                logger.warning("No API key found in request state")
        else:
            # STDIO mode: API key already in client headers from lifespan
            logger.debug("Using API key from client headers (STDIO mode)")
    
        response = await client.request(
            method=method,
            url=path,
            params=params,
            data=data,
            json=json,
            headers=extra_headers
        )
        response.raise_for_status()
        return response
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It describes the return format and example, which adds some behavioral context, but it fails to disclose critical traits: whether this is a creation or update operation (contradicting the name), what permissions are required, if it's idempotent, or any rate limits. The description adds value with the return details but leaves significant gaps for a mutation tool.

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

Conciseness3/5

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

The description is structured with sections for Args, Returns, and Example, which is helpful. However, it is overly verbose: the parameter list duplicates schema information, and the return details are extensive but could be more concise. The opening line 'Creates a SIP account' is misleading and wastes space. It is front-loaded with the contradiction, reducing effectiveness.

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?

Given no annotations, no output schema, and 15 parameters for a mutation tool, the description is incomplete. It covers return values and provides an example, which helps, but it fails to resolve the core contradiction with the tool name, lacks error handling information, and does not specify behavioral constraints like authentication needs. For a complex tool like this, more context is needed.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all 15 parameters thoroughly. The description lists parameters with brief explanations (e.g., 'call_limit: maximum call duration in seconds'), but these largely repeat or paraphrase schema descriptions without adding significant new semantics. It provides examples like 'ex: 00' for rewrite_cond, which adds minimal value. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states 'Creates a SIP account' but the tool is named 'update_sip_account', creating a direct contradiction. The description does not clarify whether this is actually a creation or update operation, and it fails to distinguish this tool from sibling tools like 'delete_sip_account' or 'get_sip_account'. This is misleading and tautological to the name conflict.

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?

The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites, such as whether an existing SIP account is required for updates, or differentiate from sibling tools like 'list_sip_accounts' or 'delete_sip_account'. Usage context is implied only through parameter documentation, with no explicit when-to-use or when-not-to-use statements.

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

Related 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/UserAd/didlogic_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server