Skip to main content
Glama
arjunkmrm

Singapore LTA MCP Server

by arjunkmrm

travel_times

Get real-time estimated travel times for Singapore expressway segments. This tool provides updated traffic data every 5 minutes to help plan routes and avoid congestion.

Instructions

Get estimated travel times on expressway segments. Updates every 5 minutes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function that executes the travel_times tool by making an API request to LTA's estimated travel times endpoint and returning the response data or handling errors.
    case "travel_times": {
      try {
        const response = await axios.get('https://datamall2.mytransport.sg/ltaodataservice/EstTravelTimes', {
          headers: {
            'AccountKey': process.env.LTA_API_KEY!,
            'accept': 'application/json'
          }
        });
        
        return {
          content: [{
            type: "text",
            text: JSON.stringify(response.data, null, 2)
          }]
        };
      } catch (error) {
        if (axios.isAxiosError(error)) {
          return {
            content: [{
              type: "text",
              text: `LTA API error: ${error.response?.data?.Message ?? error.message}`
            }],
            isError: true
          };
        }
        throw error;
      }
    }
  • Tool schema definition including name, description, and input schema (no required parameters) returned by the ListTools handler.
    {
      name: "travel_times",
      description: "Get estimated travel times on expressway segments. Updates every 5 minutes.",
      inputSchema: {
        type: "object",
        properties: {} // No parameters needed
      }
    },
  • src/index.ts:47-130 (registration)
    The tool is registered by being included in the tools list returned by the ListToolsRequestSchema handler.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [{
          name: "bus_arrival",
          description: "Get real-time bus arrival information for a specific bus stop and optionally a specific service number. Returns estimated arrival times, bus locations, and crowding levels.",
          inputSchema: {
            type: "object",
            properties: {
              busStopCode: {
                type: "string",
                description: "The unique 5-digit bus stop code"
              },
              serviceNo: {
                type: "string",
                description: "Optional bus service number to filter results"
              }
            },
            required: ["busStopCode"]
          }
        },
        {
          name: "station_crowding",
          description: "Get real-time MRT/LRT station crowdedness level for a particular train network line. Updates every 10 minutes.",
          inputSchema: {
            type: "object",
            properties: {
              trainLine: {
                type: "string",
                description: "Code of train network line (CCL, CEL, CGL, DTL, EWL, NEL, NSL, BPL, SLRT, PLRT, TEL)",
                enum: ["CCL", "CEL", "CGL", "DTL", "EWL", "NEL", "NSL", "BPL", "SLRT", "PLRT", "TEL"]
              }
            },
            required: ["trainLine"]
          }
        },
        {
          name: "train_alerts",
          description: "Get real-time train service alerts including service disruptions and shuttle services. Updates when there are changes.",
          inputSchema: {
            type: "object",
            properties: {} // No parameters needed
          }
        },
        {
          name: "carpark_availability",
          description: "Get real-time availability of parking lots for HDB, LTA, and URA carparks. Updates every minute.",
          inputSchema: {
            type: "object",
            properties: {} // No parameters needed
          }
        },
        {
          name: "travel_times",
          description: "Get estimated travel times on expressway segments. Updates every 5 minutes.",
          inputSchema: {
            type: "object",
            properties: {} // No parameters needed
          }
        },
        {
          name: "traffic_incidents",
          description: "Get current road incidents including accidents, roadworks, and heavy traffic. Updates every 2 minutes.",
          inputSchema: {
            type: "object",
            properties: {} // No parameters needed
          }
        },
        {
          name: "station_crowd_forecast",
          description: "Get forecasted MRT/LRT station crowdedness levels in 30-minute intervals.",
          inputSchema: {
            type: "object",
            properties: {
              trainLine: {
                type: "string",
                description: "Code of train network line (CCL, CEL, CGL, DTL, EWL, NEL, NSL, BPL, SLRT, PLRT, TEL)",
                enum: ["CCL", "CEL", "CGL", "DTL", "EWL", "NEL", "NSL", "BPL", "SLRT", "PLRT", "TEL"]
              }
            },
            required: ["trainLine"]
          }
        }]
      };
    });

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations, the description carries full burden. It reveals a specific behavioral trait (updates every 5 minutes) but omits other useful details like real-time vs. historical nature or coverage limitations.

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?

Two concise sentences, front-loaded with key action and resource, no redundant words. Every sentence adds value.

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

Completeness3/5

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

Given zero parameters and no output schema, the description is adequate but could be more complete by mentioning the output format (e.g., time range) or specific expressways. It provides minimal but sufficient context for a simple tool.

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

Parameters4/5

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

Input schema has zero parameters, so schema coverage is vacuously 100%. Baseline for 0 params is 4. The description adds 'expressway segments' as context, but since no parameters exist, no further parameter semantics are needed.

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 verb 'get', the resource 'estimated travel times on expressway segments', and a distinct feature 'Updates every 5 minutes'. This differentiates it from sibling tools like bus_arrival and carpark_availability.

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

Usage Guidelines2/5

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

No explicit guidance on when to use this tool versus alternatives such as traffic_incidents or train_alerts. The description only states what the tool does without contextual cues for selection.

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