Skip to main content
Glama

tcp_proxy_create

Create TCP proxies to expose database connections or external services by configuring port forwarding for Railway applications.

Instructions

[API] Create a new TCP proxy for a service

⚡️ Best for: ✓ Setting up database access ✓ Configuring external connections ✓ Exposing TCP services

⚠️ Not for: × HTTP/HTTPS endpoints (use domain_create) × Internal service communication

→ Prerequisites: service_list

→ Alternatives: domain_create

→ Next steps: tcp_proxy_list

→ Related: service_info, service_update

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
environmentIdYesID of the environment (usually obtained from service_info)
serviceIdYesID of the service
applicationPortYesPort of application/service to proxy, usually based off of the service's Dockerfile or designated running port.

Implementation Reference

  • The tool handler function that executes the tcp_proxy_create logic by invoking the tcpProxyService.
    async ({ environmentId, serviceId, applicationPort }) => {
      return tcpProxyService.createTcpProxy({
        environmentId,
        serviceId,
        applicationPort
      });
    }
  • Zod input schema defining parameters for tcp_proxy_create tool.
    {
      environmentId: z.string().describe("ID of the environment (usually obtained from service_info)"),
      serviceId: z.string().describe("ID of the service"),
      applicationPort: z.number().describe("Port of application/service to proxy, usually based off of the service's Dockerfile or designated running port.")
    },
  • Registration of all tools including tcp_proxy_create (via tcpProxyTools import and spread) with 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
        );
      });
    } 
  • Tool definition and registration in tcpProxyTools array using createTool (name, description, schema, handler).
    createTool(
      "tcp_proxy_create",
      formatToolDescription({
        type: 'API',
        description: "Create a new TCP proxy for a service",
        bestFor: [
          "Setting up database access",
          "Configuring external connections",
          "Exposing TCP services"
        ],
        notFor: [
          "HTTP/HTTPS endpoints (use domain_create)",
          "Internal service communication"
        ],
        relations: {
          prerequisites: ["service_list"],
          nextSteps: ["tcp_proxy_list"],
          alternatives: ["domain_create"],
          related: ["service_info", "service_update"]
        }
      }),
      {
        environmentId: z.string().describe("ID of the environment (usually obtained from service_info)"),
        serviceId: z.string().describe("ID of the service"),
        applicationPort: z.number().describe("Port of application/service to proxy, usually based off of the service's Dockerfile or designated running port.")
      },
      async ({ environmentId, serviceId, applicationPort }) => {
        return tcpProxyService.createTcpProxy({
          environmentId,
          serviceId,
          applicationPort
        });
      }
    ),
  • Supporting service method that calls the repository to create the TCP proxy and formats the MCP response.
      async createTcpProxy(input: TcpProxyCreateInput): Promise<CallToolResult> {
        try {
          const tcpProxy = await this.client.tcpProxies.tcpProxyCreate(input);
          return createSuccessResponse({
            text: `TCP Proxy created successfully:
    - Application Port: ${tcpProxy.applicationPort}
    - Proxy Port: ${tcpProxy.proxyPort}
    - Domain: ${tcpProxy.domain}
    - ID: ${tcpProxy.id}`,
            data: tcpProxy
          });
        } catch (error) {
          return createErrorResponse(`Error creating TCP proxy: ${formatError(error)}`);
        }
      }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively communicates that this is a creation/mutation tool (implied by 'Create'), specifies use cases and exclusions, and mentions prerequisites and related tools. However, it doesn't explicitly address potential side effects, error conditions, or what happens after creation (e.g., whether the proxy is immediately active).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with clear sections (Best for, Not for, Prerequisites, Alternatives, Next steps, Related) using bullet points and icons. Every sentence earns its place by providing actionable guidance without redundancy. The information is front-loaded with the core purpose statement.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a creation tool with 3 parameters, 100% schema coverage, but no annotations or output schema, the description provides excellent contextual guidance about when and how to use the tool. It covers prerequisites, alternatives, and related operations. The main gap is the lack of information about what the tool returns (since there's no output schema) or potential error conditions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so all parameters are documented in the schema itself. The description doesn't add any additional parameter-specific information beyond what's in the schema (e.g., it doesn't explain parameter relationships or provide examples). This meets the baseline expectation when schema coverage is complete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Create a new TCP proxy') and resource ('for a service'), distinguishing it from sibling tools like domain_create for HTTP/HTTPS endpoints. It provides concrete examples of use cases (database access, external connections, exposing TCP services) that clarify the tool's purpose beyond just the name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use this tool ('Best for: Setting up database access, Configuring external connections, Exposing TCP services') and when not to use it ('Not for: HTTP/HTTPS endpoints (use domain_create), Internal service communication'). It also lists prerequisites (service_list), alternatives (domain_create), and next/related steps, providing comprehensive guidance for tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/epitaphe360/railway-mcp'

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