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; }

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