service_delete
Remove a service from a Railway project to clean up unused resources, delete test deployments, or reorganize infrastructure. Use this tool to permanently delete services you no longer need.
Instructions
[API] Delete a service from a project
⚡️ Best for: ✓ Removing unused services ✓ Cleaning up test services ✓ Project reorganization
⚠️ Not for: × Temporary service stoppage (use service_restart) × Updating service configuration (use service_update)
→ Prerequisites: service_list, service_info
→ Alternatives: service_restart
→ Related: project_delete
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | ID of the project containing the service | |
| serviceId | Yes | ID of the service to delete |
Implementation Reference
- src/tools/service.tool.ts:161-188 (registration)Tool registration for 'service_delete', including Zod input schema, formatted description, and handler that calls serviceService.deleteServicecreateTool( "service_delete", formatToolDescription({ type: 'API', description: "Delete a service from a project", bestFor: [ "Removing unused services", "Cleaning up test services", "Project reorganization" ], notFor: [ "Temporary service stoppage (use service_restart)", "Updating service configuration (use service_update)" ], relations: { prerequisites: ["service_list", "service_info"], alternatives: ["service_restart"], related: ["project_delete"] } }), { projectId: z.string().describe("ID of the project containing the service"), serviceId: z.string().describe("ID of the service to delete") }, async ({ projectId, serviceId }) => { return serviceService.deleteService(projectId, serviceId); } ),
- src/services/service.service.ts:141-150 (handler)ServiceService.deleteService method: calls client.services.deleteService(serviceId) and handles response/errorasync deleteService(projectId: string, serviceId: string) { try { await this.client.services.deleteService(serviceId); return createSuccessResponse({ text: `Service deleted successfully` }); } catch (error) { return createErrorResponse(`Error deleting service: ${formatError(error)}`); } }
- ServiceRepository.deleteService: executes GraphQL mutation to delete the service via Railway APIasync deleteService(serviceId: string): Promise<void> { await this.client.request<{ serviceDelete: boolean }>(` mutation serviceDelete($serviceId: String!) { serviceDelete(id: $serviceId) } `, { serviceId }); }