get_facility_group_list
Retrieve youth facility group lists in South Korea with filters for region, institution name, and type to find suitable youth activity programs.
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 for 'get_facility_group_list': parses input arguments, invokes the YouthApiClient, formats the facility group list into a human-readable text summary, and returns MCP-formatted content.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/index.ts:134-162 (schema)Tool schema definition including input schema for pagination, filtering by sido, stName, and 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: "기관유형명 (선택사항)", }, }, }, },
- src/youthApiClient.ts:182-232 (helper)Helper function in YouthApiClient that makes the actual API call to the public youth activity service's getJltlsGrpList endpoint, handles XML parsing, error checking, and returns structured data.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; } }