tools.py•15.4 kB
"""
VitalDB MCP Server - Tool Definitions
"""
from mcp.types import Tool
def get_all_tools():
"""모든 MCP 도구 정의 반환"""
return [
# 기본 도구들
Tool(
name="find_cases",
description="특정 트랙(신호)을 포함하는 VitalDB 케이스를 검색합니다",
inputSchema={
"type": "object",
"properties": {
"track_names": {
"type": "array",
"items": {"type": "string"},
"description": "검색할 트랙 이름 목록"
}
},
"required": ["track_names"]
}
),
Tool(
name="get_case_info",
description="특정 케이스의 정보를 가져옵니다 (사용 가능한 트랙 목록 등)",
inputSchema={
"type": "object",
"properties": {
"case_id": {
"type": "integer",
"description": "케이스 ID"
}
},
"required": ["case_id"]
}
),
Tool(
name="search_available_tracks",
description="VitalDB에서 사용 가능한 일반적인 트랙 목록과 설명을 제공합니다",
inputSchema={
"type": "object",
"properties": {}
}
),
# 고급 필터링 도구
Tool(
name="filter_cases_by_statistics",
description="통계 조건으로 케이스를 필터링합니다. 예: '평균 심박수 > 100인 케이스 찾기'",
inputSchema={
"type": "object",
"properties": {
"track_name": {
"type": "string",
"description": "필터링할 트랙 이름 (예: 'HR', 'TEMP')"
},
"statistic": {
"type": "string",
"enum": ["mean", "median", "min", "max", "std"],
"description": "사용할 통계 지표"
},
"condition": {
"type": "string",
"description": "조건 (예: '>100', '>=80', '<60', '50-100')"
},
"candidate_cases": {
"type": "array",
"items": {"type": "integer"},
"description": "검색할 케이스 목록 (선택사항)"
},
"max_cases": {
"type": "integer",
"description": "분석할 최대 케이스 수 (기본값: 100)",
"default": 100
},
"interval": {
"type": "number",
"description": "샘플링 간격 (기본값: 1.0)",
"default": 1.0
}
},
"required": ["track_name", "statistic", "condition"]
}
),
Tool(
name="batch_analyze_cases",
description="여러 케이스를 일괄 분석하여 통계를 추출합니다",
inputSchema={
"type": "object",
"properties": {
"case_ids": {
"type": "array",
"items": {"type": "integer"},
"description": "분석할 케이스 ID 목록"
},
"track_names": {
"type": "array",
"items": {"type": "string"},
"description": "분석할 트랙 이름 목록"
},
"interval": {
"type": "number",
"description": "샘플링 간격 (기본값: 1.0)",
"default": 1.0
}
},
"required": ["case_ids", "track_names"]
}
),
Tool(
name="analyze_correlation",
description="두 트랙 간의 상관관계를 분석합니다",
inputSchema={
"type": "object",
"properties": {
"case_ids": {
"type": "array",
"items": {"type": "integer"},
"description": "분석할 케이스 ID 목록"
},
"track1": {
"type": "string",
"description": "첫 번째 트랙"
},
"track2": {
"type": "string",
"description": "두 번째 트랙"
},
"interval": {
"type": "number",
"description": "샘플링 간격 (기본값: 1.0)",
"default": 1.0
}
},
"required": ["case_ids", "track1", "track2"]
}
),
Tool(
name="compare_groups",
description="두 케이스 그룹을 비교 분석합니다",
inputSchema={
"type": "object",
"properties": {
"group1_cases": {
"type": "array",
"items": {"type": "integer"},
"description": "그룹 1의 케이스 ID 목록"
},
"group2_cases": {
"type": "array",
"items": {"type": "integer"},
"description": "그룹 2의 케이스 ID 목록"
},
"track_name": {
"type": "string",
"description": "비교할 트랙"
},
"interval": {
"type": "number",
"description": "샘플링 간격 (기본값: 1.0)",
"default": 1.0
}
},
"required": ["group1_cases", "group2_cases", "track_name"]
}
),
# 시각화 도구
Tool(
name="plot_multiple_cases",
description="여러 케이스의 트랙을 한 번에 시각화합니다 (무제한)",
inputSchema={
"type": "object",
"properties": {
"case_ids": {
"type": "array",
"items": {"type": "integer"},
"description": "플롯할 케이스 ID 목록"
},
"track_name": {
"type": "string",
"description": "플롯할 트랙"
},
"interval": {
"type": "number",
"description": "샘플링 간격 (기본값: 0.01)",
"default": 0.01
},
"start_time": {
"type": "number",
"description": "시작 시간 (초, 기본값: 0)",
"default": 0
},
"duration": {
"type": "number",
"description": "플롯 기간 (초, 기본값: 60)",
"default": 60
},
"overlay": {
"type": "boolean",
"description": "오버레이 모드 (true) 또는 서브플롯 (false, 기본값: true)",
"default": True
}
},
"required": ["case_ids", "track_name"]
}
),
Tool(
name="plot_distribution",
description="트랙 데이터의 분포를 시각화합니다 (히스토그램, 박스플롯 등)",
inputSchema={
"type": "object",
"properties": {
"case_ids": {
"type": "array",
"items": {"type": "integer"},
"description": "분석할 케이스 ID 목록"
},
"track_name": {
"type": "string",
"description": "분석할 트랙"
},
"plot_type": {
"type": "string",
"enum": ["histogram", "boxplot", "violin", "all"],
"description": "플롯 유형 (기본값: all)",
"default": "all"
},
"interval": {
"type": "number",
"description": "샘플링 간격 (기본값: 1.0)",
"default": 1.0
}
},
"required": ["case_ids", "track_name"]
}
),
Tool(
name="plot_scatter_correlation",
description="두 트랙의 산점도와 상관관계를 시각화합니다",
inputSchema={
"type": "object",
"properties": {
"case_ids": {
"type": "array",
"items": {"type": "integer"},
"description": "분석할 케이스 ID 목록"
},
"track1": {
"type": "string",
"description": "X축 트랙"
},
"track2": {
"type": "string",
"description": "Y축 트랙"
},
"interval": {
"type": "number",
"description": "샘플링 간격 (기본값: 1.0)",
"default": 1.0
}
},
"required": ["case_ids", "track1", "track2"]
}
),
Tool(
name="plot_heatmap",
description="시간대별 트랙 값의 히트맵을 생성합니다",
inputSchema={
"type": "object",
"properties": {
"case_ids": {
"type": "array",
"items": {"type": "integer"},
"description": "분석할 케이스 ID 목록"
},
"track_name": {
"type": "string",
"description": "분석할 트랙"
},
"interval": {
"type": "number",
"description": "샘플링 간격 (기본값: 1.0)",
"default": 1.0
},
"time_bins": {
"type": "integer",
"description": "시간 구간 수 (기본값: 50)",
"default": 50
}
},
"required": ["case_ids", "track_name"]
}
),
# 고급 분석 도구
Tool(
name="detect_anomalies",
description="트랙에서 이상치를 탐지합니다",
inputSchema={
"type": "object",
"properties": {
"case_id": {
"type": "integer",
"description": "케이스 ID"
},
"track_name": {
"type": "string",
"description": "분석할 트랙"
},
"method": {
"type": "string",
"enum": ["zscore", "iqr"],
"description": "이상치 탐지 방법 (기본값: zscore)",
"default": "zscore"
},
"threshold": {
"type": "number",
"description": "임계값 (기본값: 3.0)",
"default": 3.0
},
"interval": {
"type": "number",
"description": "샘플링 간격 (기본값: 0.01)",
"default": 0.01
}
},
"required": ["case_id", "track_name"]
}
),
Tool(
name="time_window_analysis",
description="특정 시간 구간의 데이터를 분석합니다",
inputSchema={
"type": "object",
"properties": {
"case_id": {
"type": "integer",
"description": "케이스 ID"
},
"track_name": {
"type": "string",
"description": "분석할 트랙"
},
"start_time": {
"type": "number",
"description": "시작 시간 (초)"
},
"end_time": {
"type": "number",
"description": "종료 시간 (초)"
},
"interval": {
"type": "number",
"description": "샘플링 간격 (기본값: 1.0)",
"default": 1.0
}
},
"required": ["case_id", "track_name", "start_time", "end_time"]
}
),
Tool(
name="export_to_csv",
description="분석 결과를 CSV 파일로 저장합니다",
inputSchema={
"type": "object",
"properties": {
"case_ids": {
"type": "array",
"items": {"type": "integer"},
"description": "저장할 케이스 ID 목록"
},
"track_names": {
"type": "array",
"items": {"type": "string"},
"description": "저장할 트랙 목록"
},
"output_path": {
"type": "string",
"description": "저장할 파일 경로"
},
"interval": {
"type": "number",
"description": "샘플링 간격 (기본값: 1.0)",
"default": 1.0
}
},
"required": ["case_ids", "track_names", "output_path"]
}
)
]