Skip to main content
Glama

publicTransitRoutes

Retrieve public transit routes from start to destination with details on fare, travel time, transfers, and distances. Specify coordinates, language, and optional search time for accurate routing.

Instructions

Retrieves public transportation routes from start to destination.

Args: startLon (str): longitude of the starting point (WSG84). startLat (str): latitude of the starting point (WSG84). destLon (str): longitude of the destination (WSG84). destLat (str): latitude of the destination (WSG84). language (int): language of the route; 0 for Korean and 1 for English. searchTime (str, optional): Sets the time for the route to be searched. Used as information to indicate whether transportation is in operation. See [service] in the response for the operation status.

Returns: route information

  • itineraries: route details

    • fare: total fare

    • totalTime: in seconds

    • transferCount:

    • totalWalkDistance: in meters

    • totalDistance: in meters

    • totalWalkTime: in seconds

    • legs: legs in the route

      • distance: in meters

      • sectionTime: in seconds

      • mode: transportation mode

      • route: transportation route

      • start: starting point of the leg

      • end: destination of the leg

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
destLatYes
destLonYes
languageNo
searchTimeNo
startLatYes
startLonYes

Implementation Reference

  • The main handler function for the 'publicTransitRoutes' tool. It defines the input schema via type hints and docstring, is registered via @mcp.tool() decorator, and delegates to TmapClient.getTransitRoutes for the API call.
    @mcp.tool()
    async def publicTransitRoutes(
      startLon: str,
      startLat: str,
      destLon: str,
      destLat: str,
      language: int = 0,
      searchTime: Optional[str] = None,
    ) -> Dict:
      """Retrieves public transportation routes from start to destination.
    
      Args:
        startLon (str): longitude of the starting point (WSG84).
        startLat (str): latitude of the starting point (WSG84).
        destLon (str): longitude of the destination (WSG84).
        destLat (str): latitude of the destination (WSG84).
        language (int): language of the route; 0 for Korean and 1 for English.
        searchTime (str, optional): Sets the time for the route to be searched.
          Used as information to indicate whether transportation is in operation.
          See [service] in the response for the operation status.
    
      Returns:
        route information
        - itineraries: route details
          - fare: total fare
          - totalTime: in seconds
          - transferCount:
          - totalWalkDistance: in meters
          - totalDistance: in meters
          - totalWalkTime: in seconds
          - legs: legs in the route
            - distance: in meters
            - sectionTime: in seconds
            - mode: transportation mode
            - route: transportation route
            - start: starting point of the leg
            - end: destination of the leg
      """
      assert (language == 0 or language == 1)
      try:
        return await tmap_client.getTransitRoutes(
          startLon, startLat,
          destLon, destLat,
          language,
          searchTime=searchTime,
        )
      except Exception as ex:
        return { "success": False, "error": str(ex) }
  • Supporting utility in TmapClient class that makes the HTTP POST request to the SK Open API for public transit routes.
    async def getTransitRoutes(
      self,
      startLon: str,
      startLat: str,
      destLon: str,
      destLat: str,
      language: int,
      count: int = 10,
      searchTime: Optional[str] = None,
    ) -> Dict:
      path = f"{self.BASE_URL}/transit/routes"
      body = {
        "startX": startLon,
        "startY": startLat,
        "endX": destLon,
        "endY": destLat,
        "lang": language,
        "count": count,
        "format": "json",
      }
      if searchTime is not None:
        body["searchDttm"] = searchTime
    
      return (await self._post(path, body)).get("metaData", {}).get("plan", {})
  • Creation of the FastMCP server instance where tools are registered via decorators.
    mcp = FastMCP("mcp_tmap", instructions=INSTRUCTIONS)
  • MCP instructions string describing the tool's purpose, input/output structure, and usage notes.
    INSTRUCTIONS = """
    TMAP MCP provides tools for accessing the mobility platform provided by TMAP in South Korea.
    
    - publicTransitRoutes: Retrieves public transit routes between two places.
      The response contains [legs], which are legs of the retrieved route.
      Use [start.name] in each leg to return a chain of legs.
      The underlying API is often rate-limited, so you have to ask a user if they really want to proceed with this tool.
    - fullTextAddressGeocoding: Converts an address in full text into coordinates.
      The response contains a list of coordinates, which are ordered by the relevancy.
      If the entered address is not accurate, the response contains coordinates of a similar location.
      Use the first item in the response to return the coordinates.
      [newLat] is the latitude and [newLon] is the longitude.
    """.strip()
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that 'searchTime' is used to indicate 'whether transportation is in operation' and references 'service' in the response, but doesn't explain authentication needs, rate limits, error conditions, or what happens if no routes are found.

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

Conciseness4/5

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

The description is well-structured with clear sections for Args and Returns, making it easy to parse. However, the return value section is somewhat verbose with nested bullet points that could be simplified, and the opening sentence could be more front-loaded with key information.

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 the complexity (6 parameters, no annotations, no output schema), the description provides good parameter documentation but lacks behavioral context. It explains what the tool returns in detail, which compensates for the missing output schema, but doesn't cover error handling, rate limits, or prerequisites.

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

Parameters5/5

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

With 0% schema description coverage, the description fully compensates by providing detailed parameter explanations beyond the schema. It explains what each parameter represents (e.g., 'longitude of the starting point (WSG84)'), clarifies the 'language' parameter's enum values (0 for Korean, 1 for English), and provides context for 'searchTime' as optional with operational status implications.

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

Purpose4/5

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

The description clearly states the tool 'retrieves public transportation routes from start to destination,' which is a specific verb+resource combination. However, it doesn't differentiate from its sibling tool 'fullTextAddressGeocoding,' which appears to be a different geocoding function rather than a route-finding alternative.

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?

The description provides no guidance on when to use this tool versus alternatives or in what context. It mentions the sibling tool 'fullTextAddressGeocoding' but doesn't explain how they relate or when to choose one over the other.

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

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/yunkee-lee/mcp-tmap'

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