Skip to main content
Glama
YCloud-Developers

YCloud WhatsApp API MCP Server

wa_template_create

Create WhatsApp message templates for business communication using the YCloud API. Generate reusable message formats for consistent customer interactions.

Instructions

Create a template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyNo

Implementation Reference

  • src/tools.ts:125-127 (registration)
    Specific logic that shortens OpenAPI operation IDs matching 'whatsapp_template_create' to the MCP tool name 'wa_template_create'.
    } else if (operationId.includes('whatsapp_template_create')) {
      operationId = 'wa_template_create';
    } else {
  • Helper function that generates Zod schemas for input parameters from OpenAPI operation definitions, used for all tools including 'wa_template_create'.
    function extractParamsSchema(operation: any): any {
      const properties: Record<string, any> = {};
      const required: string[] = [];
    
      // 处理路径参数
      if (operation.parameters) {
        operation.parameters.forEach((param: any) => {
          if (param.in === 'path' || param.in === 'query') {
            let schema;
            switch (param.schema?.type) {
              case 'string':
                schema = z.string();
                break;
              case 'integer':
                schema = z.number().int();
                break;
              case 'number':
                schema = z.number();
                break;
              case 'boolean':
                schema = z.boolean();
                break;
              default:
                schema = z.any();
            }
            
            properties[param.name] = schema;
            if (param.required) {
              required.push(param.name);
            }
          }
        });
      }
    
      // 处理请求体
      if (operation.requestBody) {
        properties['body'] = z.any();
        required.push('body');
      }
    
      return properties;
    }
  • src/tools.ts:155-219 (registration)
    Dynamic registration of the 'wa_template_create' tool (and others) using McpServer.tool(), including schema and shared handler.
    if (!registeredTools.has(toolName)) {
      server.tool(
        toolName,
        description,
        paramsSchema,
        async (args: Record<string, any>) => {
          try {
            // 解析URL中的路径参数
            let url = `${apiBaseUrl}${path}`;
            Object.keys(args).forEach(key => {
              if (path.includes(`{${key}}`)) {
                url = url.replace(`{${key}}`, encodeURIComponent(String(args[key])));
                delete args[key];
              }
            });
            
            // 提取请求体和查询参数
            const { body, ...queryParams } = args as Record<string, any>;
            
            // 设置请求选项
            const requestOptions: any = {
              url,
              method: method.toUpperCase(),
              headers: { 
                'Content-Type': 'application/json',
                ...headers
              },
              params: Object.keys(queryParams).length > 0 ? queryParams : undefined,
              data: body,
            };
            
            // 发送请求
            const response = await axios(requestOptions);
            return {
              content: [{ type: 'text' as const, text: JSON.stringify(response.data, null, 2) }]
            };
          } catch (error: unknown) {
            if (axios.isAxiosError(error) && error.response) {
              return {
                content: [{
                  type: 'text' as const,
                  text: JSON.stringify({
                    error: true,
                    status: error.response.status,
                    message: error.response.data?.message || error.message,
                    data: error.response.data
                  }, null, 2)
                }]
              };
            }
            return {
              content: [{
                type: 'text' as const,
                text: JSON.stringify({
                  error: true,
                  message: error instanceof Error ? error.message : String(error)
                }, null, 2)
              }]
            };
          }
        }
      );
      registeredTools.add(toolName);
      registeredToolsCount++;
    }
Behavior1/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 but fails completely. 'Create a template' implies a write/mutation operation but doesn't specify what permissions are needed, whether the creation is immediate or requires approval, what happens on failure, or what the response contains. For a mutation tool with zero annotation coverage, this is critically inadequate.

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 maximally concise with just two words. While this represents severe under-specification, from a pure conciseness perspective, it's efficient with zero wasted words. Every word earns its place, though there are far too few words to be helpful.

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

Completeness1/5

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

Given this is a mutation tool (create operation) with no annotations, 0% schema description coverage, no output schema, and multiple sibling tools, the description is completely inadequate. It doesn't explain what gets created, how to use it, what parameters are needed, what the response looks like, or when to choose this tool over alternatives. This fails to provide the minimal context needed for effective tool use.

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

Parameters1/5

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

The input schema has 1 parameter ('body') with 0% schema description coverage, meaning the schema provides no documentation about this parameter. The description offers no information about what the 'body' parameter should contain, its format, structure, or required fields. For a single undocumented parameter, the description should compensate but provides zero parameter semantics.

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

Purpose2/5

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

The description 'Create a template' is a tautology that merely restates the tool name 'wa_template_create'. It doesn't specify what kind of template (WhatsApp message template), what platform it's for, or what the template contains. While the 'wa_' prefix suggests WhatsApp context, the description itself provides no meaningful elaboration beyond the name.

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

Usage Guidelines1/5

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

The description provides absolutely no guidance about when to use this tool versus alternatives. There are multiple sibling template tools (wa_template_delete, wa_template_delete_by_name, wa_template_edit, wa_template_get, wa_template_list), but the description offers no differentiation. It doesn't mention prerequisites, appropriate contexts, or when this tool should be preferred over others.

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

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/YCloud-Developers/ycloud-whatsapp-mcp-server'

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