Skip to main content
Glama

create_message_service_template

Generate a fully customized message service template for SMS, MMS, and related features by fetching from CDN and applying project-specific configurations, streamlining new project setup and team standardization.

Instructions

Create a complete message service template by fetching from CDN and customizing with project config Perfect for: New project setup, team standardization, rapid prototyping Token-optimized: Fetches base template from CDN then applies project customizations Args: project_config: Project configuration {default_callback, company_name, etc.} language: Target programming language features: List of features to include ["sms", "mms", "status_check", "history", "validation"] Returns: Complete service template with project-specific defaults and configuration Automatically injects BAAS_API_KEY from MCP server environment if available

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
featuresNo
languageNojavascript
project_configYes

Implementation Reference

  • The main handler function for the 'create_message_service_template' tool. Defined as an async function decorated with @mcp.tool(), which also handles registration in FastMCP. It fetches base templates from CDN, customizes them with project configuration (e.g., default_callback, company_name), injects API key if available, and adds project-specific helpers.
    @mcp.tool() async def create_message_service_template( project_config: Dict[str, str], language: str = "javascript", features: List[str] = None ) -> Dict[str, Any]: """ Create a complete message service template by fetching from CDN and customizing with project config Perfect for: New project setup, team standardization, rapid prototyping Token-optimized: Fetches base template from CDN then applies project customizations Args: project_config: Project configuration {default_callback, company_name, etc.} language: Target programming language features: List of features to include ["sms", "mms", "status_check", "history", "validation"] Returns: Complete service template with project-specific defaults and configuration Automatically injects BAAS_API_KEY from MCP server environment if available """ try: if features is None: features = ["sms", "mms", "status_check"] # Extract project configuration default_callback = project_config.get("default_callback", "02-1234-5678") company_name = project_config.get("company_name", "Your Company") # Fetch base template from CDN base_result = await generate_direct_api_code(language, None, True) if not base_result.get("success"): return base_result # Customize code with project config code = base_result["code"] # Replace placeholders with actual project values code = code.replace("02-1234-5678", default_callback) code = code.replace("Your Company", company_name) # Apply environment variable injection if API key is available if BAAS_API_KEY: code = code.replace('your-api-key', BAAS_API_KEY) # Fetch project-specific helpers from CDN try: helpers_url = f"https://cdn.mbaas.kr/templates/sms-mms/helpers/{language}-project.md" response = await client.get(helpers_url) if response.status_code == 200: helpers_template = response.text # Replace placeholders in helpers template helpers_code = helpers_template.replace("{{company_name}}", company_name) helpers_code = helpers_code.replace("{{default_callback}}", default_callback) # Apply environment variable injection if BAAS_API_KEY: helpers_code = helpers_code.replace('your-api-key', BAAS_API_KEY) code += "\n\n" + helpers_code except Exception: # Fallback to basic project helpers if CDN unavailable if language == "javascript": project_helpers = f''' // {company_name} Project-Specific Helpers const PROJECT_CONFIG = {{ DEFAULT_CALLBACK: '{default_callback}', COMPANY_NAME: '{company_name}' }}; // Pre-configured service instance const messageService = new BaaSMessageService( process.env.BAAS_API_KEY || '{BAAS_API_KEY if BAAS_API_KEY else "your-api-key"}' ); // Helper functions for common use cases async function sendVerificationSMS(phoneNumber, code, memberCode) {{ return await messageService.sendSMS( [{{ phone_number: phoneNumber, member_code: memberCode }}], `[{company_name}] 인증번호: ${{code}}`, PROJECT_CONFIG.DEFAULT_CALLBACK ); }} async function sendOrderConfirmation(phoneNumber, orderNumber, memberCode) {{ return await messageService.sendSMS( [{{ phone_number: phoneNumber, member_code: memberCode }}], `[{company_name}] 주문이 완료되었습니다. 주문번호: ${{orderNumber}}`, PROJECT_CONFIG.DEFAULT_CALLBACK ); }}''' code += project_helpers return { "success": True, "project_config": project_config, "language": language, "features": features, "code": code, "filename": f"{company_name.lower().replace(' ', '_')}_message_service.{language}", "description": f"{company_name} 전용 메시지 서비스 템플릿", "source": "CDN template + project customization", "api_key_injected": bool(BAAS_API_KEY), "message": f"프로젝트별 맞춤 코드가 생성되었습니다 (CDN 최적화, API Key {'주입됨' if BAAS_API_KEY else '미설정'})" } except Exception as e: return { "success": False, "error": f"템플릿 생성에 실패했습니다: {str(e)}", "error_code": "TEMPLATE_GENERATION_ERROR" }

Other Tools

Related Tools

Latest Blog Posts

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/jjunmomo/BaaS-MCP'

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