@mcp.tool()
async def get_code_template_url(
language: str,
framework: Optional[str] = None,
deployment_platform: Optional[str] = None
) -> Dict[str, Any]:
"""
Get URL for BaaS SMS/MMS integration code template from CDN
Perfect for: Getting optimized, maintained code templates without token overhead
Args:
language: Programming language (javascript, python, php, java, go, csharp)
framework: Optional framework (react, vue, django, laravel, fastapi, spring, etc.)
deployment_platform: Optional platform (vercel, netlify, aws, docker, etc.)
Returns:
CDN URL to markdown file with complete code examples and integration guide
Templates include direct API calls to https://api.aiapp.link with /api/message/ endpoints
"""
try:
language = language.lower()
framework = framework.lower() if framework else None
platform = deployment_platform.lower() if deployment_platform else None
# CDN base URL with llms.txt optimization
base_url = "https://cdn.mbaas.kr/templates/sms-mms"
# Construct template path
template_path = language
if framework:
template_path += f"/{framework}"
else:
template_path += "/vanilla"
template_url = f"{base_url}/{template_path}.md"
# Platform-specific integration guide
integration_url = None
if platform:
integration_url = f"{base_url}/deployment/{platform}.md"
# Supported combinations
supported_languages = ["javascript", "python", "php", "java", "go", "csharp"]
if language not in supported_languages:
return {
"success": False,
"error": f"언어 '{language}'는 아직 지원되지 않습니다",
"supported_languages": supported_languages,
"error_code": "UNSUPPORTED_LANGUAGE"
}
return {
"success": True,
"language": language,
"framework": framework,
"deployment_platform": platform,
"template_url": template_url,
"integration_url": integration_url,
"api_endpoint": "https://api.aiapp.link/api/message/",
"cdn_info": {
"cache_duration": "24시간",
"last_updated": "자동 업데이트",
"version": "latest"
},
"configuration": {
"required_env_vars": ["BAAS_API_KEY"],
"installation_guide": f"{base_url}/setup/{language}.md",
"api_key_injected": bool(BAAS_API_KEY)
},
"message": f"{language} 템플릿 URL을 제공합니다. 토큰 최적화를 위해 CDN에서 직접 다운로드하세요."
}
except Exception as e:
return {
"success": False,
"error": f"템플릿 URL 생성에 실패했습니다: {str(e)}",
"error_code": "URL_GENERATION_ERROR"
}