configure_api_token
Set or update the Railway API token for authentication. Required if not already configured in environment variables.
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
| 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 handler function for the configure_api_token tool. It receives a token string, calls railwayClient.setToken(token) to set the API token, and returns success/error responses.
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:27-28 (schema)Input schema for the configure_api_token tool: a single 'token' string parameter described as 'Railway API token (create one at https://railway.app/account/tokens)'.
token: z.string().describe("Railway API token (create one at https://railway.app/account/tokens)") }, - src/tools/index.ts:30-37 (registration)Registration of all tools including configTools (which contains configure_api_token) via server.tool(...) in the registerAllTools function.
// Register each tool with the server allTools.forEach((tool) => { server.tool( ...tool ); }); } - src/utils/tools.ts:13-25 (helper)The createTool helper function used to construct the tool tuple (name, description, schema, handler) for configure_api_token.
export function createTool<T extends z.ZodRawShape>( name: string, description: string, schema: T, handler: ToolCallback<T> ): Tool<T> { return [ name, description, schema, handler ] as const; } - src/api/api-client.ts:62-67 (helper)The setToken method on RailwayApiClient that the handler calls to set and validate the API token.
async setToken(token: string | null): Promise<void> { this.token = token; if (token) { await this.validateToken(); } }