Skip to main content
Glama
jjunmomo

BaaS SMS/MCP Server

by jjunmomo

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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"
            }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: fetching from CDN, applying project customizations, and automatically injecting BAAS_API_KEY from environment. However, it lacks details on error handling, rate limits, or authentication requirements, which would be valuable for a tool with external dependencies.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded with the core purpose. Each sentence earns its place: the first states what it does, the second provides usage scenarios, the third explains the optimization approach, and the parameter/return sections add necessary details without redundancy. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (3 parameters including nested objects, external CDN dependency) and the presence of an output schema (which handles return value documentation), the description is mostly complete. It covers purpose, usage, parameters, and key behaviors like environment variable injection. The main gap is lack of error/edge case handling information, which prevents a perfect score.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate. It provides meaningful context for all three parameters: 'project_config' is explained as containing 'default_callback, company_name, etc.', 'language' as 'Target programming language', and 'features' with a concrete example list. This adds significant value beyond the bare schema, though it doesn't specify all possible feature values or config properties.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Create a complete message service template') and the method ('by fetching from CDN and customizing with project config'). It distinguishes itself from sibling tools like 'generate_direct_api_code' and 'get_code_template_url' by focusing on template creation with customization rather than code generation or URL retrieval.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly provides usage scenarios ('Perfect for: New project setup, team standardization, rapid prototyping') and includes a 'Token-optimized' note that hints at efficiency considerations. While it doesn't name specific alternatives, the context of sibling tools suggests differentiation in use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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