Skip to main content
Glama
wagonbomb

Megaraptor MCP

by wagonbomb

generate_gpo_package

Create GPO deployment bundles for Windows domain environments by generating MSI installers, configuration files, and setup documentation to deploy agents across networks.

Instructions

Generate a GPO deployment bundle for Windows domain environments.

Creates MSI installer, configuration files, and step-by-step GPO setup documentation.

Args: deployment_id: The deployment to generate package for domain_controller: Name of the domain controller (for share paths) labels: Labels to apply to deployed agents

Returns: Path to GPO package and deployment instructions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deployment_idYes
domain_controllerNoDC01
labelsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The 'generate_gpo_package' tool handler generates an MSI installer package for Windows GPO deployment, including necessary configuration and GPO setup documentation.
    async def generate_gpo_package(
        deployment_id: str,
        domain_controller: str = "DC01",
        labels: Optional[list[str]] = None,
    ) -> list[TextContent]:
        """Generate a GPO deployment bundle for Windows domain environments.
    
        Creates MSI installer, configuration files, and step-by-step GPO
        setup documentation.
    
        Args:
            deployment_id: The deployment to generate package for
            domain_controller: Name of the domain controller (for share paths)
            labels: Labels to apply to deployed agents
    
        Returns:
            Path to GPO package and deployment instructions.
        """
        try:
            from pathlib import Path
            from datetime import datetime, timezone
    
            from ..deployment.agents import InstallerGenerator
            from ..deployment.agents.installer_gen import InstallerConfig, InstallerType
            from ..deployment.security import CertificateManager
            from ..deployment.deployers import DockerDeployer
    
            # Get deployment info
            deployer = DockerDeployer()
            info = await deployer.get_status(deployment_id)
    
            if not info:
                return [TextContent(
                    type="text",
                    text=json.dumps({
                        "error": f"Deployment not found: {deployment_id}",
                        "hint": "Use list_deployments tool to see available deployments"
                    }, indent=2)
                )]
    
            # Load certificates
            cert_manager = CertificateManager()
            bundle = cert_manager.load_bundle(deployment_id)
    
            if not bundle:
                return [TextContent(
                    type="text",
                    text=json.dumps({
                        "error": "Certificate bundle not found"
                    }, indent=2)
                )]
    
            # Create output directory
            output_dir = Path(os.environ.get("LOCALAPPDATA", "~")).expanduser() / "megaraptor-mcp" / "gpo" / deployment_id
            output_dir.mkdir(parents=True, exist_ok=True)
    
            # Generate MSI installer config
            config = InstallerConfig(
                server_url=info.server_url.replace("/api/", "") + f":{8000}/",
                ca_cert=bundle.ca_cert,
                ca_fingerprint=bundle.ca_fingerprint,
                labels=labels or ["gpo-deployed"],
                deployment_id=deployment_id,
            )
    
            # Generate installer
            generator = InstallerGenerator(output_dir=output_dir)
            installer = await generator.generate(config, InstallerType.MSI)
    
            # Generate GPO instructions from template
            try:
                from jinja2 import Template
                from ..deployment.templates import get_template_path
    
                template_path = get_template_path("gpo_instructions.md.j2")
                template = Template(template_path.read_text())
    
                instructions = template.render(
                    deployment_id=deployment_id,
                    generated_at=datetime.now(timezone.utc).isoformat(),
                    server_url=info.server_url,
                    server_hostname=info.server_url.split("://")[1].split(":")[0],
                    frontend_port=8000,
                    domain_controller=domain_controller,
                    ca_fingerprint=bundle.ca_fingerprint,
                )
    
                instructions_file = output_dir / "GPO_Instructions.md"
                instructions_file.write_text(instructions)
    
            except Exception:
                # Fallback if Jinja2 not available
                instructions_file = output_dir / "GPO_Instructions.txt"
                instructions_file.write_text(f"GPO deployment instructions for {deployment_id}")
    
            # Copy CA certificate
            ca_file = output_dir / "ca.crt"
            ca_file.write_text(bundle.ca_cert)
    
            return [TextContent(
                type="text",
                text=json.dumps({
                    "success": True,
                    "output_directory": str(output_dir),
                    "files": [
                        str(installer.file_path),
                        str(instructions_file),
                        str(ca_file),
                    ],
                    "instructions": f"See {instructions_file.name} for deployment steps",
                    "ca_fingerprint": bundle.ca_fingerprint,
                }, indent=2)
            )]
    
        except ImportError as e:
            return [TextContent(
                type="text",
                text=json.dumps({
                    "error": f"Missing dependency: {str(e)}",
                    "hint": "Install required packages with: pip install megaraptor-mcp[deployment]"
                }, indent=2)
            )]
    
        except Exception:
            # Generic errors - don't expose internals
            return [TextContent(
                type="text",
                text=json.dumps({
                    "error": "Operation failed",
                    "hint": "Check deployment configuration and try again"
                }, indent=2)
            )]
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool creates files (MSI, configuration files, documentation) and returns a path, but omits critical behavioral details such as side effects (where files are written), idempotency, failure modes, or whether the deployment_id must exist beforehand.

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 docstring format with Args/Returns sections provides logical structure. The opening sentence is specific and actionable. Minor redundancy exists between the opening paragraph and the Args/Returns sections, but overall information density is appropriate without excessive verbosity.

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 tool with an existing output schema (per context signals), the description appropriately summarizes the return value (path and instructions) without over-specifying. However, it lacks mention of prerequisites (e.g., deployment validation requirements) or execution context that would help an agent handle errors.

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?

Given 0% schema description coverage, the Args section effectively compensates by explaining all three parameters: deployment_id (target deployment), domain_controller (for share paths), and labels (for agents). While functional, descriptions are minimal and could elaborate on formats or valid values.

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 clearly states the specific action (Generate) and target resource (GPO deployment bundle) with scope (Windows domain environments). It effectively distinguishes from sibling tools like deploy_agents_ssh or generate_ansible_playbook by explicitly mentioning GPO/Windows domain specificity.

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

Usage Guidelines3/5

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

While the description implies usage through GPO-specific terminology (MSI installer, domain controller), it lacks explicit when-to-use guidance comparing this to alternative deployment methods (e.g., WinRM, SSH, Ansible) available in the sibling tools. No prerequisites or exclusions are stated.

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/wagonbomb/megaraptor-mcp'

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