Skip to main content
Glama

template_deploy

Deploy new services from pre-configured templates to quickly launch applications on Railway infrastructure, ideal for starting projects with standardized setups.

Instructions

[WORKFLOW] Deploy a new service from a template

⚡️ Best for: ✓ Starting new services from templates ✓ Quick service deployment ✓ Using pre-configured templates

⚠️ Not for: × Custom service configurations × GitHub repository deployments (use service_create_from_repo)

→ Prerequisites: template_list

→ Alternatives: service_create_from_repo, service_create_from_image, database_deploy

→ Next steps: service_info, variable_list

→ Related: service_update, deployment_trigger

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesID of the project to create the service in
templateIdYesID of the template to use
environmentIdYesID of the environment to deploy to
teamIdNoID of the team to create the service in (if not provided, will use the default team)

Implementation Reference

  • Handler function that executes the tool logic by delegating to templatesService.deployTemplate(projectId, templateId, environmentId, teamId).
    async ({ projectId, templateId, environmentId, teamId }: { 
      projectId: string;
      templateId: string;
      environmentId: string;
      teamId?: string;
    }) => {
      return templatesService.deployTemplate(projectId, templateId, environmentId, teamId);
    }
  • Input schema using Zod validators and descriptions for the tool parameters.
    {
      projectId: z.string().describe("ID of the project to create the service in"),
      templateId: z.string().describe("ID of the template to use"),
      environmentId: z.string().describe("ID of the environment to deploy to"),
      teamId: z.string().optional().describe("ID of the team to create the service in (if not provided, will use the default team)")
    },
  • Registration of the template_deploy tool via createTool, including formatted description, input schema, and handler function.
    createTool(
      "template_deploy",
      formatToolDescription({
        type: 'WORKFLOW',
        description: "Deploy a new service from a template",
        bestFor: [
          "Starting new services from templates",
          "Quick service deployment",
          "Using pre-configured templates"
        ],
        notFor: [
          "Custom service configurations",
          "GitHub repository deployments (use service_create_from_repo)"
        ],
        relations: {
          prerequisites: ["template_list"],
          alternatives: ["service_create_from_repo", "service_create_from_image", "database_deploy"],
          nextSteps: ["service_info", "variable_list"],
          related: ["service_update", "deployment_trigger"]
        }
      }),
      {
        projectId: z.string().describe("ID of the project to create the service in"),
        templateId: z.string().describe("ID of the template to use"),
        environmentId: z.string().describe("ID of the environment to deploy to"),
        teamId: z.string().optional().describe("ID of the team to create the service in (if not provided, will use the default team)")
      },
      async ({ projectId, templateId, environmentId, teamId }: { 
        projectId: string;
        templateId: string;
        environmentId: string;
        teamId?: string;
      }) => {
        return templatesService.deployTemplate(projectId, templateId, environmentId, teamId);
      }
    ),
  • Core implementation logic in TemplatesService: retrieves template details by ID from list, then invokes repository deployment, formats success/error responses.
    async deployTemplate(
      projectId: string,
      templateId: string,
      environmentId: string,
      teamId?: string,
    ) {
      try {
        // Get the template
        const templates = await this.client.templates.listTemplates();
        const template = templates.find(t => t.id === templateId);
        
        if (!template) {
          return createErrorResponse(`Template not found: ${templateId}`);
        }
    
        // Deploy the template
        const response = await this.client.templates.deployTemplate(environmentId, projectId, template.serializedConfig, templateId, teamId);
    
        return createSuccessResponse({
          text: `Created new service "${template.name}" from template ${template.name} in project ${projectId}. Monitoring workflow status with ID: ${response.workflowId}`,
          data: response
        });
      } catch (error) {
        return createErrorResponse(`Error creating service from template: ${formatError(error)}`);
      }
    }
  • Repository method that performs the GraphQL mutation 'templateDeployV2' to initiate the template deployment workflow.
    async deployTemplate(environmentId: string, projectId: string, serializedConfig: { services: Record<string, ServiceConfig> }, templateId: string, teamId?: string) {
      const query = `
        mutation deployTemplate($environmentId: String, $projectId: String, $templateId: String!, $teamId: String, $serializedConfig: SerializedTemplateConfig!) {
          templateDeployV2(input: {
            environmentId: $environmentId,
            projectId: $projectId,
            templateId: $templateId,
            teamId: $teamId,
            serializedConfig: $serializedConfig
          }) {
            projectId
            workflowId
          }
        }
      `;
    
      const response = await this.client.request<{ templateDeployV2: { projectId: string, workflowId: string } }>(query, {
        environmentId,
        projectId,
        templateId,
        teamId,
        serializedConfig,
      });
    
      return response.templateDeployV2;
    }
Behavior4/5

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

With no annotations provided, the description carries full burden. It effectively communicates this is a deployment/mutation tool (implied by 'Deploy'), mentions prerequisites (template_list), and suggests related operations (service_update, deployment_trigger). However, it doesn't explicitly state permission requirements, rate limits, or what happens if deployment fails, leaving some behavioral aspects unclear.

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?

The description is well-structured with clear sections (Best for, Not for, Prerequisites, Alternatives, Next steps, Related) using visual markers (✓, ×, →). Every sentence serves a distinct purpose with zero waste. The information is front-loaded with the core purpose stated first.

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 deployment tool with no annotations and no output schema, the description provides excellent contextual guidance about usage scenarios, alternatives, prerequisites, and next steps. It effectively compensates for the lack of structured behavioral annotations. The only minor gap is not explicitly describing the return value or deployment outcome.

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 4 parameters thoroughly. The description adds no additional parameter-specific information beyond what's in the schema. This meets the baseline expectation when schema coverage is complete, but doesn't enhance understanding of parameter semantics.

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 tool's purpose with specific verb+resource: 'Deploy a new service from a template'. It distinguishes from siblings by explicitly mentioning what it's not for (custom configurations, GitHub deployments) and listing alternatives like service_create_from_repo. The [WORKFLOW] tag further clarifies its role.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use ('Best for: Starting new services from templates, Quick service deployment') and when not to use ('Not for: Custom service configurations, GitHub repository deployments'). It names specific alternatives (service_create_from_repo, service_create_from_image, database_deploy) and lists prerequisites (template_list) and next steps (service_info, variable_list).

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/epitaphe360/railway-mcp'

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