Skip to main content
Glama
anoopt

TfL Journey Status MCP Server

get_line_status_detail

Check real-time status and disruption details for specific London Underground lines to plan journeys and avoid delays.

Instructions

Get the status and details of a TfL line.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lineIdYesThe identifier of the line to query (e.g., victoria, central).
app_keyNoOptional application key for authentication.

Implementation Reference

  • Handler function that executes the tool logic: fetches detailed status from TfL API for the specified line ID.
    const executeFunction = async ({ lineId, app_key }) => {
      if (!lineId) {
        throw new Error('lineId is required');
      }
    
      const params = new URLSearchParams([['detail', 'true']]);
      if (app_key) {
        params.append('app_key', app_key);
      }
    
      const url = `https://api.tfl.gov.uk/Line/${encodeURIComponent(lineId)}/Status?${params.toString()}`;
      
      try {
        const response = await fetch(url, {
          method: 'GET',
          headers: {
            'Content-Type': 'application/json'
          }
        });
    
        if (!response.ok) {
          const errorData = await response.json();
          throw new Error(JSON.stringify(errorData));
        }
    
        return await response.json();
      } catch (error) {
        console.error('Error fetching status and details:', error);
        return {
          error: `An error occurred while fetching status and details: ${error instanceof Error ? error.message : JSON.stringify(error)}`
        };
      }
    };
  • Tool definition object `apiTool` containing the schema (name, description, parameters) and reference to handler function.
    const apiTool = {
      function: executeFunction,
      definition: {
        type: 'function',
        function: {
          name: 'get_line_status_detail',
          description: 'Get the status and details of a TfL line.',
          parameters: {
            type: 'object',
            properties: {
              lineId: {
                type: 'string',
                description: 'The identifier of the line to query (e.g., victoria, central).'
              },
              app_key: {
                type: 'string',
                description: 'Optional application key for authentication.'
              }
            },
            required: ['lineId']
          }
        }
      }
    };
  • tools/paths.js:1-5 (registration)
    toolPaths array registers the paths to tool files, including status-detail.js, used by discoverTools.
    export const toolPaths = [
      'tfl/status.js',
      'tfl/status-detail.js',
      'tfl/journey-planner.js'
    ];
  • lib/tools.js:7-30 (registration)
    discoverTools function loads apiTool from each path (including status-detail.js) and returns array of tools for MCP server registration.
    export async function discoverTools() {
      const tools = await Promise.all(
        toolPaths.map(async (file) => {
          const { apiTool } = await import(`../tools/${file}`);
          return { ...apiTool, path: file };
        })
      );
    
      // deduplicate tool names
      const nameCounts = {};
    
      return tools.map((tool) => {
        const name = tool.definition?.function?.name;
        if (!name) return tool;
    
        nameCounts[name] = (nameCounts[name] || 0) + 1;
    
        if (nameCounts[name] > 1) {
          tool.definition.function.name = `${name}_${nameCounts[name]}`;
        }
    
        return tool;
      });
    }
Behavior2/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 states the tool retrieves status and details but does not mention critical aspects like authentication requirements (implied by the optional 'app_key' parameter), rate limits, error handling, or the format of returned data. This leaves significant gaps in understanding the tool's behavior.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy for an agent to parse quickly.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete for effective tool use. It does not explain what 'status and details' entail, how results are structured, or any behavioral traits like authentication needs. For a tool with two parameters and no structured output information, this leaves the agent under-informed.

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%, with clear descriptions for both parameters in the input schema. The description does not add any additional meaning beyond what the schema provides, such as examples of line IDs beyond 'victoria' or 'central', or details on when 'app_key' is required. This meets the baseline for adequate but not enhanced parameter semantics.

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 verb ('Get') and resource ('status and details of a TfL line'), making the purpose specific and understandable. However, it does not explicitly differentiate from the sibling tool 'get_line_status', which likely provides similar functionality, leaving room for ambiguity in tool selection.

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, such as the sibling 'get_line_status' or 'plan_journey'. It lacks context about use cases, prerequisites, or exclusions, leaving the agent to infer usage based on tool names alone.

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/anoopt/london-tfl-journey-status-mcp-server'

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