configure_api_token
Set up or update the Railway API token for authentication when not configured in environment variables. This tool handles initial setup and token management for accessing Railway infrastructure.
Instructions
[UTILITY] Configure the Railway API token for authentication (only needed if not set in environment variables)
⚡️ Best for: ✓ Initial setup ✓ Token updates ✓ Authentication configuration
⚠️ Not for: × Project configuration × Service settings × Environment variables
→ Next steps: project_list, service_list
→ Related: project_create
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | Railway API token (create one at https://railway.app/account/tokens) |
Implementation Reference
- src/tools/config.tool.ts:29-51 (handler)The main handler function for the 'configure_api_token' tool. It sets the Railway API token using railwayClient.setToken(token) and returns a success or error message in a structured format.async ({ token }) => { try { await railwayClient.setToken(token); return { content: [ { type: "text" as const, text: `✅ Successfully connected to Railway API`, }, ], }; } catch (error) { return { isError: true, content: [ { type: "text" as const, text: `❌ Failed to connect to Railway API: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } }
- src/tools/config.tool.ts:26-28 (schema)Input schema using Zod, defining a single 'token' parameter of type string with description.{ token: z.string().describe("Railway API token (create one at https://railway.app/account/tokens)") },
- src/tools/config.tool.ts:6-52 (registration)The createTool call that registers the 'configure_api_token' tool, providing name, formatted description, input schema, and handler function.createTool( "configure_api_token", formatToolDescription({ type: 'UTILITY', description: "Configure the Railway API token for authentication (only needed if not set in environment variables)", bestFor: [ "Initial setup", "Token updates", "Authentication configuration" ], notFor: [ "Project configuration", "Service settings", "Environment variables" ], relations: { nextSteps: ["project_list", "service_list"], related: ["project_create"] } }), { token: z.string().describe("Railway API token (create one at https://railway.app/account/tokens)") }, async ({ token }) => { try { await railwayClient.setToken(token); return { content: [ { type: "text" as const, text: `✅ Successfully connected to Railway API`, }, ], }; } catch (error) { return { isError: true, content: [ { type: "text" as const, text: `❌ Failed to connect to Railway API: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } } )