get_facility_group_list
Retrieve youth facility group lists with filters for region, institution name, and type to find youth activity programs in South Korea.
Instructions
청소년 시설 그룹 목록을 조회합니다. 시도, 기관명, 기관유형으로 필터링 가능합니다
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pageNo | No | 페이지 번호 (기본값: 1) | |
| numOfRows | No | 한 페이지 결과 수 (기본값: 10) | |
| sido | No | 시도명 (선택사항) | |
| stName | No | 기관명 (선택사항) | |
| gName | No | 기관유형명 (선택사항) |
Implementation Reference
- src/index.ts:338-388 (handler)MCP tool handler case for 'get_facility_group_list': extracts parameters from tool call, invokes the YouthApiClient method, formats the paginated results into a human-readable text response with details like facility name, institution, type, address, and phone.case "get_facility_group_list": { const params = { pageNo: (args?.pageNo as number) || 1, numOfRows: (args?.numOfRows as number) || 10, sido: args?.sido as string | undefined, stName: args?.stName as string | undefined, gName: args?.gName as string | undefined, }; const result = await youthApiClient.getFacilityGroupList(params); let resultText = `🏢 청소년 시설 그룹 목록 (전체 ${result.totalCount}개)\n\n`; if (Array.isArray(result.items)) { result.items.forEach((item: any, index: number) => { const itemNum = (params.pageNo - 1) * params.numOfRows + index + 1; resultText += `${itemNum}. ${item.faciNm || "시설명 없음"}\n`; if (item.instlNm) resultText += ` 기관명: ${item.instlNm}\n`; if (item.gNm) resultText += ` 유형: ${item.gNm}\n`; if (item.rdnmadr) resultText += ` 주소: ${item.rdnmadr}\n`; if (item.phoneNumber) resultText += ` 전화: ${item.phoneNumber}\n`; resultText += "\n"; }); } else if (result.items) { resultText += `1. ${result.items.faciNm || "시설명 없음"}\n`; if (result.items.instlNm) resultText += ` 기관명: ${result.items.instlNm}\n`; if (result.items.gNm) resultText += ` 유형: ${result.items.gNm}\n`; resultText += "\n"; } else { resultText += "검색된 시설이 없습니다.\n\n"; } resultText += `페이지: ${params.pageNo}/${Math.ceil( result.totalCount / params.numOfRows )}`; return { content: [ { type: "text", text: resultText, }, ], }; }
- src/youthApiClient.ts:182-232 (handler)Core implementation of getFacilityGroupList in YouthApiClient: makes HTTP GET to '/getJltlsGrpList' endpoint with pagination and filter params, parses XML response using xml2js, validates resultCode, extracts totalCount and items, handles errors.async getFacilityGroupList(params: { pageNo?: number; numOfRows?: number; sido?: string; // 시도 stName?: string; // 기관명 gName?: string; // 기관유형명 }): Promise<any> { try { const response = await this.client.get("/getJltlsGrpList", { params: { serviceKey: this.serviceKey, pageNo: params.pageNo || 1, numOfRows: params.numOfRows || 10, sido: params.sido, stName: params.stName, gName: params.gName, }, }); const parsedData = await this.parseXmlResponse(response.data); if (parsedData.response) { const header = parsedData.response.header; const body = parsedData.response.body; if (header?.resultCode !== "00") { throw new Error( `API 오류: ${header?.resultMsg || "알 수 없는 오류"}` ); } return { totalCount: parseInt(body?.totalCount || "0"), items: body?.items?.item || [], pageNo: params.pageNo || 1, numOfRows: params.numOfRows || 10, }; } throw new Error("예상치 못한 응답 형식"); } catch (error) { if (axios.isAxiosError(error)) { throw new Error( `API 호출 실패: ${error.message}${ error.response?.data ? ` - ${error.response.data}` : "" }` ); } throw error; } }
- src/index.ts:134-162 (registration)MCP tool registration in ListToolsRequestSchema handler: defines name 'get_facility_group_list', description, and inputSchema for parameters like pageNo, numOfRows, sido, stName, gName.{ name: "get_facility_group_list", description: "청소년 시설 그룹 목록을 조회합니다. 시도, 기관명, 기관유형으로 필터링 가능합니다", inputSchema: { type: "object", properties: { pageNo: { type: "number", description: "페이지 번호 (기본값: 1)", }, numOfRows: { type: "number", description: "한 페이지 결과 수 (기본값: 10)", }, sido: { type: "string", description: "시도명 (선택사항)", }, stName: { type: "string", description: "기관명 (선택사항)", }, gName: { type: "string", description: "기관유형명 (선택사항)", }, }, }, },