Skip to main content
Glama

template_deploy

Deploy new services on Railway-MCP using pre-configured templates. Streamline service initiation by selecting templates, specifying project and environment IDs, and avoiding custom configurations.

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
environmentIdYesID of the environment to deploy to
projectIdYesID of the project to create the service in
teamIdNoID of the team to create the service in (if not provided, will use the default team)
templateIdYesID of the template to use

Implementation Reference

  • Registration of the 'template_deploy' tool, including formatted description, Zod input schema, and handler function that delegates to templatesService.deployTemplate
    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);
      }
    ),
  • TemplatesService.deployTemplate: Fetches the template by ID, then calls the repository to perform the deployment, returns success/error response with workflow ID
    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)}`);
      }
    }
  • TemplateRepository.deployTemplate: Executes GraphQL mutation 'templateDeployV2' to deploy the template and returns projectId and workflowId
    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;
    }
  • MCP server registration of all tools, including templateTools which contains template_deploy via spread operator at line 28
    export function registerAllTools(server: McpServer) {
      // Collect all tools
      const allTools = [
        ...databaseTools,
        ...deploymentTools,
        ...domainTools,
        ...projectTools,
        ...serviceTools,
        ...tcpProxyTools,
        ...variableTools,
        ...configTools,
        ...volumeTools,
        ...templateTools,
      ] as Tool[];
    
      // Register each tool with the server
      allTools.forEach((tool) => {
        server.tool(
          ...tool
        );
      });
    } 
Behavior4/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 effectively communicates this is a creation/mutation tool ('Deploy a new service'), mentions it's for 'quick service deployment' implying efficiency, and links to related tools for updates and monitoring. However, it doesn't explicitly state permission requirements, rate limits, or error handling details.

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), uses bullet points and symbols for readability, and every sentence adds value without redundancy. It's appropriately sized for a tool with multiple usage contexts.

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 mutation tool with no annotations and no output schema, the description does an excellent job covering purpose, usage guidelines, and workflow context. It mentions prerequisites and next steps, which adds valuable operational context. The only minor gap is lack of explicit information about return values or error conditions.

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 fully documents all 4 parameters. The description doesn't add any parameter-specific information beyond what's in the schema (e.g., it doesn't explain how to obtain templateId or environmentId). This meets the baseline expectation when schema coverage is complete.

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 ('Deploy a new service from a template'), identifies the resource ('service'), and distinguishes it from siblings by explicitly mentioning alternatives like 'service_create_from_repo' and 'service_create_from_image'. The '[WORKFLOW]' prefix further clarifies it's part of a deployment workflow.

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 with 'Best for' and 'Not for' sections, names specific alternatives (service_create_from_repo, service_create_from_image, database_deploy), lists prerequisites (template_list), and suggests next steps (service_info, variable_list). This comprehensively covers when to use this tool versus other options.

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/jason-tan-swe/railway-mcp'

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