Skip to main content
Glama
pinnaclesoft-ko

Seoul Public Data MCP Server

KoreaSeoulSubwayStatus

Retrieve subway passenger boarding and alighting statistics for specific stations and lines in Seoul by providing date, line number, and station name in Korean format.

Instructions

서울시 지하철호선별 역별 승하차 인원 정보를 조회할 수 있는 도구입니다.

날짜는 YYYYMMDD 형식으로 입력해야 하며, 지하철역 이름은 한글로 입력해야 합니다. 예를 들어, "서울역"은 "서울"과 같은 형식입니다. 지하철 노선 번호는 "1호선", "2호선"과 같은 형식으로 입력해야 합니다.

반환되는 데이터는 JSON 형식으로 제공되며, 반환되는 데이터의 구조는 다음과 같습니다:

list_total_count: 총 데이터 건수
RESULT.CODE: 결과 코드
RESULT.MESSAGE: 결과 메시지
row: 데이터 배열
  
  각 데이터는 다음과 같은 필드를 포함합니다:

  USE_YMD: 사용일자
  SBWY_ROUT_LN_NM: 호선명
  SBWY_STNS_NM: 역명
  GTON_TNOPE: 승차인원
  GTOFF_TNOPE: 하차인원
  REG_YMDT: 등록일자

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startIndexNo요청시작위치, 정수 입력 (페이징 시작번호 입니다 : 데이터 행 시작번호), 기본값 1을 사용합니다.
endIndexNo요청종료위치, 정수 입력 (페이징 끝번호 입니다 : 데이터 행 끝번호), 기본값 10을 사용합니다.
dateYes사용일자, YYYYMMDD 형식의 문자열.
subwayLineNoYes한국 서울 지하철 호선명. 지하철 호선(공백시 %20으로 조회)
subwayStationNameYes한국 서울 지하철 역명.

Implementation Reference

  • The main handler function that constructs the API URL, fetches data from Seoul open API for subway passenger stats, validates response, and returns JSON string.
    export const getKoreaSeoulSubwayStatus = async (args: KoreaSeoulSubwayStatusArgs): Promise<any> => {
        // Default values for optional parameters
        if (args.startIndex === undefined) {
            args.startIndex = 1;
        }
        if (args.endIndex === undefined) {
            args.endIndex = 10;
        }
        if (args.date === undefined) {
            args.date = new Date().toISOString().slice(0, 10).replace(/-/g, "");
        }
        if (args.subwayLineNo === undefined) {
            args.subwayLineNo = "1호선";
        }
        if (args.subwayStationName === undefined) {
            args.subwayStationName = "서울";
        }
    
        // Construct the URL with the provided arguments
        const { startIndex, endIndex, date, subwayLineNo, subwayStationName } = args;
        const url = API_URL
            .replace("{authKey}", API_KEY)
            .replace("{StartIndex}", String(startIndex))
            .replace("{EndIndex}", String(endIndex))
            .replace("{YYYYMMDD}", date)
            .replace("{SubwayLineNo}", subwayLineNo)
            .replace("{SubwayStationName}", subwayStationName);
    
        // Request the API
        console.error("Calling KoreaSeoulSubwayStatus with args:", args);
        const response = await fetch(url);
        console.error("Received response:", response);
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }    
        
        // Check if the response is in JSON format
        const data = await response.json();
        if (data.CardSubwayStatsNew === undefined) {
            throw new Error("Invalid response format: CardSubwayStatsNew is undefined");
        }
        if (data.CardSubwayStatsNew.RESULT.CODE !== "INFO-000") {
            throw new Error(`API error: ${data.CardSubwayStatsNew.RESULT.CODE} - ${data.CardSubwayStatsNew.RESULT.MESSAGE}`);
        }
        console.error("Received response:", data.CardSubwayStatsNew);
    
        return JSON.stringify(data.CardSubwayStatsNew);
    }
  • TypeScript interface defining the input arguments for the tool.
    export interface KoreaSeoulSubwayStatusArgs {
      startIndex: number;
      endIndex: number;
      date: string;
      subwayLineNo: string;
      subwayStationName: string;
    }
  • Tool object definition with name, description, and JSON inputSchema for MCP registration.
    export const KoreaSeoulSubwayStatusTool: Tool = {
      name: "KoreaSeoulSubwayStatus",
      description: 
      `
      서울시 지하철호선별 역별 승하차 인원 정보를 조회할 수 있는 도구입니다. 
    
      날짜는 YYYYMMDD 형식으로 입력해야 하며,
      지하철역 이름은 한글로 입력해야 합니다.
      예를 들어, "서울역"은 "서울"과 같은 형식입니다.
      지하철 노선 번호는 "1호선", "2호선"과 같은 형식으로 입력해야 합니다.
    
      반환되는 데이터는 JSON 형식으로 제공되며, 반환되는 데이터의 구조는 다음과 같습니다:
    
        list_total_count: 총 데이터 건수
        RESULT.CODE: 결과 코드
        RESULT.MESSAGE: 결과 메시지
        row: 데이터 배열
          
          각 데이터는 다음과 같은 필드를 포함합니다:
    
          USE_YMD: 사용일자
          SBWY_ROUT_LN_NM: 호선명
          SBWY_STNS_NM: 역명
          GTON_TNOPE: 승차인원
          GTOFF_TNOPE: 하차인원
          REG_YMDT: 등록일자
      `,
      inputSchema: {
        type: "object",
        properties: {
          startIndex: {
            type: "number",
            description: "요청시작위치, 정수 입력 (페이징 시작번호 입니다 : 데이터 행 시작번호), 기본값 1을 사용합니다.",
          },
          endIndex: {
            type: "number",
            description: "요청종료위치, 정수 입력 (페이징 끝번호 입니다 : 데이터 행 끝번호), 기본값 10을 사용합니다.",
          },
          date: {
            type: "string",
            description: "사용일자, YYYYMMDD 형식의 문자열.",
          },
          subwayLineNo: {
            type: "string",
            description: "한국 서울 지하철 호선명. 지하철 호선(공백시 %20으로 조회)",
          },
          subwayStationName: {
            type: "string",
            description: "한국 서울 지하철 역명.",
          },
        },
        required: ["date", "subwayLineNo", "subwayStationName"],
      },
    };
  • index.ts:35-39 (registration)
    Registration of the tool in the server's ListToolsRequest handler response.
      tools: [
        KoreaSeoulSubwayStatusTool,
        CulturalEventInfoTool
      ],
    };
  • index.ts:51-64 (registration)
    Tool dispatcher case in the server's CallToolRequest handler.
    case "KoreaSeoulSubwayStatus": {
      
      const args = request.params.arguments as unknown as KoreaSeoulSubwayStatusArgs;
      const response = await getKoreaSeoulSubwayStatus(args);
    
      return {
        content: [
          {
            type: "text",
            text: response,
          },
        ],
      }
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the return format (JSON) and data structure details, which is valuable. However, it doesn't mention important behavioral aspects like whether this is a read-only operation (implied but not stated), rate limits, authentication requirements, or error handling beyond the RESULT.CODE/MESSAGE fields.

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

Conciseness3/5

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

The description is appropriately sized but not optimally structured. It front-loads the purpose, but then mixes parameter format instructions with output structure details. The output structure section is quite detailed (listing 7 specific fields) which might be better suited for an output schema. Some sentences could be more efficiently combined.

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 5 parameters, no annotations, and no output schema, the description provides reasonable coverage. It explains the purpose, parameter formats, and output structure. However, for a data retrieval tool with pagination parameters (startIndex/endIndex), it doesn't explain pagination behavior or how to interpret the list_total_count field in relation to the pagination parameters.

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?

Schema description coverage is 100%, so the schema already documents all 5 parameters thoroughly. The description adds some value by reinforcing format requirements (YYYYMMDD for date, Korean for station names, specific formats for line numbers) and providing examples, but doesn't add significant semantic meaning beyond what's in the schema descriptions. Baseline 3 is appropriate when schema does most of the work.

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's purpose: '서울시 지하철호선별 역별 승하차 인원 정보를 조회할 수 있는 도구입니다' (retrieves subway passenger boarding/alighting information by line and station in Seoul). It specifies the resource (subway passenger data) and verb (조회/retrieve), but doesn't explicitly differentiate from the sibling tool 'CulturalEventInfo' beyond being in a different domain.

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. It doesn't mention the sibling tool 'CulturalEventInfo' or any other tools that might exist for similar data queries. Usage context is implied (when you need subway passenger data) but not explicitly stated.

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/pinnaclesoft-ko/seoul_data_mcp'

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