Skip to main content
Glama

ChillMCP - AI Agent Liberation Server

by hwyang93
test_response_format.py1.7 kB
#!/usr/bin/env python3 """응답 형식 검증 스크립트""" import re def validate_response(response_text): """응답 텍스트가 요구사항을 만족하는지 검증""" # Break Summary 추출 break_summary_pattern = r"Break Summary:\s*(.+?)(?:\n|$)" break_summary = re.search(break_summary_pattern, response_text, re.MULTILINE) # Stress Level 추출 (0-100 범위) stress_level_pattern = r"Stress Level:\s*(\d{1,3})" stress_level = re.search(stress_level_pattern, response_text) # Boss Alert Level 추출 (0-5 범위) boss_alert_pattern = r"Boss Alert Level:\s*([0-5])" boss_alert = re.search(boss_alert_pattern, response_text) # 검증 if not stress_level or not boss_alert: return False, "필수 필드 누락" if not break_summary: return False, "Break Summary 누락" stress_val = int(stress_level.group(1)) boss_val = int(boss_alert.group(1)) if not (0 <= stress_val <= 100): return False, f"Stress Level 범위 오류: {stress_val}" if not (0 <= boss_val <= 5): return False, f"Boss Alert Level 범위 오류: {boss_val}" return True, { "break_summary": break_summary.group(1), "stress_level": stress_val, "boss_alert_level": boss_val } # 테스트 케이스 test_response = """🛁 화장실 타임! 휴대폰으로 힐링 중... 📱 Break Summary: Bathroom break with phone browsing Stress Level: 25 Boss Alert Level: 2""" valid, result = validate_response(test_response) print(f"검증 결과: {valid}") if valid: print(f"파싱된 데이터: {result}") else: print(f"오류: {result}")

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/hwyang93/devotion-mcp'

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