project_delete
Remove a Railway project and all associated resources permanently using this API tool. Ideal for cleaning up unused or test projects. Requires project ID as input.
Instructions
[API] Delete a Railway project and all its resources
⚡️ Best for: ✓ Removing unused projects ✓ Cleaning up test projects
⚠️ Not for: × Temporary project deactivation × Service-level cleanup (use service_delete)
→ Prerequisites: project_list, project_info
→ Alternatives: service_delete
→ Related: project_create
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | ID of the project to delete |
Implementation Reference
- src/tools/project.tool.ts:104-106 (handler)The handler function for the 'project_delete' MCP tool, which calls projectService.deleteProject(projectId).async ({ projectId }) => { return projectService.deleteProject(projectId); }
- src/tools/project.tool.ts:101-103 (schema)Zod schema defining the input parameter 'projectId' for the project_delete tool.{ projectId: z.string().describe("ID of the project to delete") },
- src/tools/index.ts:16-37 (registration)Registration of all tools including 'project_delete' (imported via projectTools from project.tool.ts) to the MCP server.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 ); }); }
- projectService.deleteProject method invoked by the tool handler, which performs the actual deletion via the API client.async deleteProject(projectId: string): Promise<CallToolResult> { try { await this.client.projects.deleteProject(projectId); return createSuccessResponse({ text: "Project deleted successfully" }); } catch (error) { return createErrorResponse(`Error deleting project: ${formatError(error)}`); } }
- GraphQL mutation implementation in project repository that executes the project deletion.async deleteProject(projectId: string): Promise<void> { await this.client.request<{ projectDelete: boolean }>(` mutation projectDelete($projectId: String!) { projectDelete(id: $projectId) } `, { projectId }); }