Skip to main content
Glama

link-environment

Link a specific workspace to a Railway environment or list available environments for selection using the Railway MCP Server tool.

Instructions

Link to a specific Railway environment. If no environment is specified, it will list available environments for selection.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
environmentNameYesThe environment name to link to
workspacePathYesThe path to the workspace to link the environment to

Implementation Reference

  • The handler function that executes the core logic of the 'link-environment' tool by calling the CLI linker and handling responses/errors.
    handler: async ({ workspacePath, environmentName, }: LinkEnvironmentOptions) => { try { const result = await linkRailwayEnvironment({ workspacePath, environmentName, }); return createToolResponse(result); } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return createToolResponse( "❌ Failed to link environment\n\n" + `**Error:** ${errorMessage}\n\n` + "**Next Steps:**\n" + "• Ensure you have a Railway project linked\n" + "• Check that the environment name is correct\n" + "• Run `railway environment` to see available environments", ); } },
  • Zod input schema defining parameters for the tool: workspacePath (string) and environmentName (string).
    inputSchema: { workspacePath: z .string() .describe("The path to the workspace to link the environment to"), environmentName: z.string().describe("The environment name to link to"), },
  • src/index.ts:21-31 (registration)
    Registers all tools (including 'link-environment') exported from './tools' with the MCP server.
    Object.values(tools).forEach((tool) => { server.registerTool( tool.name, { title: tool.title, description: tool.description, inputSchema: tool.inputSchema, }, tool.handler, ); });
  • src/tools/index.ts:8-8 (registration)
    Exports the linkEnvironmentTool for inclusion in the aggregated tools module used by the MCP server.
    export { linkEnvironmentTool } from "./link-environment";

Other Tools

Related Tools

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/railwayapp/railway-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server