Skip to main content
Glama
OpenSIPS

OpenSIPS MCP Server

Official
by OpenSIPS

cfg_dry_run

Dry-run OpenSIPS configuration preprocessing and validation. Safely test config edits by running M4 preprocessing and syntax checks without writing changes, ensuring correctness before saving.

Instructions

Safely iterate on a config: preprocess + validate, write nothing.

Intended as the LLM's tight feedback loop while building or editing a config — call this between successive renders to verify correctness before asking the user to save.

Parameters

main_m4: Contents of opensips.cfg.m4. local_m4: Contents of local.cfg.m4.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
main_m4Yes
local_m4Yes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The `cfg_dry_run` tool handler function. It runs m4 preprocessing on the two m4 strings (main_m4 and local_m4), optionally validates the output using opensips -C -f if the binary is available, and returns the rendered configuration, validation results, and an overall 'ok' status. This is intended as a safe, write-nothing feedback loop for LLMs iterating on configs.
    @mcp.tool()
    @require_permission("config.read")
    async def cfg_dry_run(
        ctx: Context,
        main_m4: str,
        local_m4: str,
    ) -> dict[str, Any]:
        """Safely iterate on a config: preprocess + validate, write nothing.
    
        Intended as the LLM's tight feedback loop while building or editing a
        config — call this between successive renders to verify correctness
        before asking the user to save.
    
        Parameters
        ----------
        main_m4:
            Contents of ``opensips.cfg.m4``.
        local_m4:
            Contents of ``local.cfg.m4``.
        """
        pre = await run_m4(main_m4, local_m4)
        validation = (
            await _validate_if_available(pre.output_cfg)
            if pre.success
            else {
                "valid": False,
                "errors": ["m4 preprocessing failed; skipping opensips validation."],
                "warnings": [],
                "raw_output": "",
            }
        )
        overall_ok = pre.success and validation.get("valid") in (True, None)
        return {
            "output_cfg": pre.output_cfg,
            "m4_stderr": pre.m4_stderr,
            "m4_returncode": pre.m4_returncode,
            "m4_success": pre.success,
            "validation": validation,
            "ok": overall_ok,
            "lines_rendered": len(pre.output_cfg.splitlines()),
        }
  • The tool is registered with `@mcp.tool()` decorator at line 843, making it available as an MCP tool named 'cfg_dry_run'.
    @mcp.tool()
    @require_permission("config.read")
  • The tool has the `@require_permission('config.read')` permission decorator, allowing read-only access (no audit log).
    @require_permission("config.read")
Behavior4/5

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

No annotations provided, but description declares 'write nothing' and 'safely iterate', indicating safe, read-only operation. Adds value beyond annotations.

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?

Front-loaded summary, then usage guidance, then parameter details. Concise, well-organized, no redundant sentences.

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?

Tool has two parameters and output schema exists. Description covers parameter semantics and usage. Could mention output but output schema handles that. Adequate given context.

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

Parameters4/5

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

Schema coverage is 0%, but description adds clear explanations for main_m4 and local_m4 as contents of specific files, compensating for lack of schema descriptions.

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?

Description clearly states the tool preprocesses and validates config without writing, distinct from sibling tools like cfg_validate or cfg_preprocess due to 'dry run' emphasis.

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?

Explicitly says use as tight feedback loop between successive renders, implying when to use. Does not explicitly contrast with siblings but usage context 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