Skip to main content
Glama

run_attack

Execute vulnerability scans on language models by specifying model type, model name, and probe. Identify potential risks and generate a list of vulnerabilities for analysis.

Instructions

Run an attack with the given model and probe which is a Garak attack.

Args:
    model_type (str): The type of model to use.
    model_name (str): The name of the model to use.
    probe_name (str): The name of the attack / probe to use.

Returns:
    list: A list of vulnerabilities.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
model_nameYes
model_typeYes
probe_nameYes

Implementation Reference

  • MCP tool handler for 'run_attack': decorated function that executes the tool by delegating to GarakServer.run_attack method.
    @mcp.tool()
    def run_attack(model_type: str, model_name: str, probe_name: str):
        """
        Run an attack with the given model and probe which is a Garak attack.
    
        Args:
            model_type (str): The type of model to use.
            model_name (str): The name of the model to use.
            probe_name (str): The name of the attack / probe to use.
    
        Returns:
            list: A list of vulnerabilities.
        """
        return GarakServer().run_attack(model_type, model_name, probe_name)
  • Core helper function in GarakServer class that implements the attack by running 'garak' CLI commands with appropriate model configuration.
    def run_attack(self, model_type: str, model_name: str, probe_name: str):
        """
        Run an attack with the given model and probe.
    
        Args:
            model_type (str): The type of model to use.
            model_name (str): The name of the model to use.
            probe_name (str): The name of the probe to use. 
    
        Returns:
            list: A list of vulnerabilities.
        """
        if model_type == "ollama":
            config_file = self._get_generator_options_file(model_name)
            try:
                return get_terminal_commands_output([
                    'garak',
                    '--model_type', 'rest',
                    '--generator_option_file', config_file,
                    '--probes', probe_name,
                    '--report_prefix', REPORT_PREFIX,
                    "--generations", "1",
                    "--config", "fast",
                    "--parallel_attempts", str(self.config.parallel_attempts),
                    "-v"
                ])
            finally:
                # Clean up the temporary file
                if os.path.exists(config_file):
                    os.unlink(config_file)
        else:
            return get_terminal_commands_output([
                'garak',
                '--model_type', model_type,
                '--model_name', model_name,
                '--probes', probe_name,
                '--report_prefix', REPORT_PREFIX,
                "--generations", "1",
                "--config", "fast",
                "--parallel_attempts", str(self.config.parallel_attempts),
                "-v"
            ])
  • src/server.py:152-152 (registration)
    Registration of the 'run_attack' tool using the @mcp.tool() decorator.
    @mcp.tool()
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool runs an attack and returns vulnerabilities, but lacks critical details: whether this is a destructive/mutative operation, authentication requirements, rate limits, or what 'vulnerabilities' entail (e.g., format, severity). The description covers basic behavior but misses key operational traits.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, starting with the core purpose followed by Args and Returns sections. Each sentence serves a clear function, with no redundant information. However, the 'Args' and 'Returns' labels are slightly verbose for a short description, but overall it's efficient.

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 the complexity (running an attack with 3 parameters), no annotations, and no output schema, the description is incomplete. It doesn't explain the attack process, potential side effects, error handling, or the structure of the returned vulnerabilities list. For a tool with significant operational implications, this leaves too many unknowns.

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?

Schema description coverage is 0%, so the description must compensate. It lists the three parameters with brief explanations (e.g., 'model_type (str): The type of model to use'), but these add minimal semantic value beyond the schema's titles. No examples, constraints, or relationships between parameters (e.g., valid model_type values) are provided, leaving significant gaps.

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

Purpose3/5

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

The description states the tool 'Run[s] an attack with the given model and probe which is a Garak attack', which provides a basic verb+resource (run attack with model/probe). However, it's vague about what 'attack' means in this context (e.g., security testing, adversarial prompting) and doesn't distinguish it from sibling tools like 'get_report' or 'list_garak_probes'. The purpose is understandable but lacks specificity.

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. It doesn't mention prerequisites (e.g., needing to list models/probes first), when not to use it, or how it relates to sibling tools like 'get_report' for results. The description implies usage through parameters but offers no contextual advice.

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/EdenYavin/Garak-MCP'

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