Skip to main content
Glama

create_application

Create and manage ArgoCD applications by specifying details such as name, project, repository URL, and destination server. Automate sync, prune resources, and enable self-healing for efficient deployment.

Instructions

Create a new application in ArgoCD

Args:
    name: The name of the application (required)
    project: The project name (required)
    repo_url: The Git repository URL (required)
    path: Path within the repository (required)
    dest_server: Destination K8s API server URL (required)
    dest_namespace: Destination namespace (required)
    revision: Git revision (default: HEAD)
    automated_sync: Enable automated sync (default: False)
    prune: Auto-prune resources (default: False)
    self_heal: Enable self-healing (default: False)
    namespace: Application namespace
    validate: Whether to validate the application before creation
    upsert: Whether to update the application if it already exists

Returns:
    The created application details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
automated_syncNo
dest_namespaceYes
dest_serverYes
nameYes
namespaceNo
pathYes
projectYes
pruneNo
repo_urlYes
revisionNoHEAD
self_healNo
upsertNo
validateNo

Implementation Reference

  • The handler function that implements the create_application tool. It constructs an Application object from parameters, adds sync policy if needed, converts to API format, and POSTs to ArgoCD API.
    async def create_application(
        name: str,
        project: str,
        repo_url: str,
        path: str,
        dest_server: str,
        dest_namespace: str,
        revision: str = "HEAD",
        automated_sync: bool = False,
        prune: bool = False,
        self_heal: bool = False,
        namespace: str = "",
        validate: bool = True,
        upsert: bool = False,
    ) -> Dict[str, Any]:
        """
        Create a new application in ArgoCD
    
        Args:
            name: The name of the application (required)
            project: The project name (required)
            repo_url: The Git repository URL (required)
            path: Path within the repository (required)
            dest_server: Destination K8s API server URL (required)
            dest_namespace: Destination namespace (required)
            revision: Git revision (default: HEAD)
            automated_sync: Enable automated sync (default: False)
            prune: Auto-prune resources (default: False)
            self_heal: Enable self-healing (default: False)
            namespace: Application namespace
            validate: Whether to validate the application before creation
            upsert: Whether to update the application if it already exists
    
        Returns:
            The created application details
        """
        # Create application structure
        app = Application(
            name=name,
            project=project,
            source=ApplicationSource(
                repo_url=repo_url, path=path, target_revision=revision
            ),
            destination=ApplicationDestination(
                server=dest_server, namespace=dest_namespace
            ),
        )
    
        # Add sync policy if automated sync is enabled
        if automated_sync:
            app.sync_policy = ApplicationSyncPolicy(
                automated=True, prune=prune, self_heal=self_heal
            )
    
        if namespace:
            app.namespace = namespace
    
        # Convert to API format
        data = application_to_api_format(app)
    
        # Add query parameters
        params = {}
        if validate:
            params["validate"] = "true"
        if upsert:
            params["upsert"] = "true"
    
        success, response = await make_api_request(
            "applications", method="POST", data=data, params=params
        )
    
        if success:
            logger.info(f"Application '{name}' created successfully")
            return response
        else:
            logger.error(f"Failed to create application '{name}': {response.get('error')}")
            return {"error": response.get("error", "Failed to create application")}
  • server.py:43-43 (registration)
    Registers the create_application function as an MCP tool using the FastMCP tool decorator.
    mcp.tool()(applications.create_application)
  • Dataclass defining the Application model used by the create_application handler for structuring input data and serialization to ArgoCD API format.
    class Application:
        """
        ArgoCD application model
        """
    
        name: str
        project: str
        source: ApplicationSource
        destination: ApplicationDestination
        sync_policy: Optional[ApplicationSyncPolicy] = None
        namespace: str = "argocd"
        status: Optional[ApplicationStatus] = None
  • Helper function to convert the Application dataclass to the exact dictionary format required by the ArgoCD API, used within the handler.
    def application_to_api_format(app: Application) -> Dict[str, Any]:
        """
        Convert an Application object to the format expected by ArgoCD API
    
        Args:
            app: Application object
    
        Returns:
            Dictionary in ArgoCD API format
        """
        source = {
            "repoURL": app.source.repo_url,
            "path": app.source.path,
            "targetRevision": app.source.target_revision,
        }
    
        # Add optional source fields if they exist
        if app.source.helm is not None:
            source["helm"] = app.source.helm  # type: ignore
        if app.source.kustomize is not None:
            source["kustomize"] = app.source.kustomize  # type: ignore
        if app.source.directory is not None:
            source["directory"] = app.source.directory  # type: ignore
    
        destination = {
            "server": app.destination.server,
            "namespace": app.destination.namespace,
        }
    
        if app.destination.name:
            destination["name"] = app.destination.name
    
        result = {
            "metadata": {"name": app.name, "namespace": app.namespace},
            "spec": {"project": app.project, "source": source, "destination": destination},
        }
    
        # Add sync policy if provided
        if app.sync_policy:
            sync_policy = {}
    
            if app.sync_policy.automated:
                sync_policy["automated"] = {
                    "prune": app.sync_policy.prune,
                    "selfHeal": app.sync_policy.self_heal,
                    "allowEmpty": app.sync_policy.allow_empty,
                }
    
            if app.sync_policy.sync_options:
                # Convert to list for compatibility with API
                sync_policy["syncOptions"] = list(app.sync_policy.sync_options)  # type: ignore
    
            if app.sync_policy.retry:
                sync_policy["retry"] = app.sync_policy.retry
    
            # Add the sync policy to the spec
            spec = result.get("spec")
            if isinstance(spec, dict):
                spec["syncPolicy"] = sync_policy
    
        return result
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. While it states this is a creation operation, it doesn't describe what happens on failure, whether the operation is idempotent, what permissions are required, or what side effects might occur. The mention of 'upsert' hints at update behavior but doesn't explain the implications. For a mutation tool with zero annotation coverage, this is insufficient.

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 well-structured with clear sections (Args, Returns) and uses bullet-like formatting for parameters. Every sentence earns its place, though the opening statement could be slightly more front-loaded with context about ArgoCD. Overall, it's appropriately sized for a tool with many parameters.

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

Completeness3/5

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

Given the complexity (13 parameters, mutation operation, no annotations, no output schema), the description does well on parameter documentation but lacks crucial behavioral context. It doesn't explain what 'application details' are returned, error conditions, or operational implications. For a creation tool in a deployment system, this leaves significant gaps in understanding how to use it effectively.

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?

With 0% schema description coverage and 13 parameters, the description provides excellent compensation by documenting every parameter with clear semantics, required status, and default values. It adds substantial meaning beyond what the bare schema provides, transforming a completely undocumented parameter set into a well-explained one.

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 ('Create a new application') and resource ('in ArgoCD'), distinguishing it from siblings like delete_application, update_application, and list_applications. It provides a complete verb+resource+context statement that leaves no ambiguity about what this tool does.

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 like update_application (which has an 'upsert' parameter that could overlap) or when creation might fail. There's no mention of prerequisites, dependencies, or typical use cases that would help an agent choose between this and sibling tools.

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/severity1/argocd-mcp'

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