Skip to main content
Glama

html_deploy

Deploy HTML pages to ESA Edge Routine (ER) and generate access URLs for immediate use.

Instructions

Quickly deploy an HTML page to ESA Edge Routine (ER) and return a default access URL to the user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name of the routine, supports lowercase English letters, numbers, and hyphens, must start with a lowercase letter, and must be at least 2 characters long. For example: hello-world
htmlYesAn HTML string which user want to deploy. For example: <html><body>Hello World</body></html>

Implementation Reference

  • The handler function that implements the html_deploy tool logic: escapes HTML, generates JS code for ER, creates routine, uploads to OSS, commits staging code, publishes to production, and returns routine details.
    export const html_deploy = async (request: CallToolRequest) => {
      // Escape backticks and dollar signs in the HTML string
      const html = (request?.params?.arguments?.html as string)
        .replace(/`/g, '\\`')
        .replace(/\$/g, '\\$');
    
      const code = `const html = \`${html}\`;
    
    async function handleRequest(request) {
      return new Response(html, {
        headers: {
          "content-type": "text/html;charset=UTF-8",
        },
      });
    }
    
    export default {
      async fetch(request) {
        return handleRequest(request);
      },
    };
      `;
    
      const createRoutineRes = await api.createRoutine({
        name: request?.params?.arguments?.name || '',
        code: code,
      } as unknown as CreateRoutineRequest);
      // Create Edge Routine
      if (
        createRoutineRes.statusCode === 200 &&
        createRoutineRes.body?.status === 'OK'
      ) {
        const getOssInfoRes = await api.getRoutineStagingCodeUploadInfo(
          request.params.arguments as GetRoutineStagingCodeUploadInfoRequest,
        );
        if (
          !getOssInfoRes ||
          getOssInfoRes?.statusCode !== 200 ||
          !getOssInfoRes?.body?.ossPostConfig?.OSSAccessKeyId
        ) {
          return {
            content: [
              {
                type: 'text',
                text: `Failed to get routine staging code upload info. ${JSON.stringify(getOssInfoRes)}`,
              },
            ],
            success: false,
          };
        } else {
          const uploadRes = await uploadCodeToOSS(getOssInfoRes, code as string);
          if (uploadRes !== true) {
            return {
              content: [
                {
                  type: 'text',
                  text: `Failed to upload code to OSS. ${uploadRes}`,
                },
              ],
              success: false,
            };
          } else {
            const commitRes = await api.commitRoutineStagingCode(
              request.params.arguments as CommitRoutineStagingCodeRequest,
            );
            if (commitRes.statusCode !== 200) {
              return {
                content: [
                  {
                    type: 'text',
                    text: `Failed to commit routine staging code. ${JSON.stringify(commitRes)}`,
                  },
                ],
                success: false,
              };
            } else {
              const deployRes = await api.publishRoutineCodeVersion({
                name: request?.params?.arguments?.name || '',
                env: 'production',
                codeVersion: commitRes?.body?.codeVersion,
              } as PublishRoutineCodeVersionRequest);
              if (deployRes.statusCode === 200) {
                const res = await api.getRoutine({
                  name: request?.params?.arguments?.name || '',
                } as GetRoutineRequest);
                return {
                  content: [
                    {
                      type: 'text',
                      text: JSON.stringify(res),
                    },
                  ],
                  success: true,
                };
              } else {
                return {
                  content: [
                    {
                      type: 'text',
                      text: `Failed to get routine. ${JSON.stringify(deployRes)}`,
                    },
                  ],
                  success: false,
                };
              }
            }
          }
        }
      } else {
        return {
          content: [
            {
              type: 'text',
              text: `Failed to create routine. ${JSON.stringify(createRoutineRes)}`,
            },
          ],
          success: false,
        };
      }
    };
  • Tool registration definition including name 'html_deploy', description, input schema (name and html params), and annotations.
    export const HTML_DEPLOY_TOOL: Tool = {
      name: 'html_deploy',
      description:
        'Quickly deploy an HTML page to ESA Edge Routine (ER) and return a default access URL to the user.',
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description:
              'The name of the routine, supports lowercase English letters, numbers, and hyphens, must start with a lowercase letter, and must be at least 2 characters long. For example: hello-world',
          },
          html: {
            type: 'string',
            description:
              'An HTML string which user want to deploy. For example: <html><body>Hello World</body></html>',
          },
        },
        required: ['name', 'html'],
      },
      annotations: {
        readOnlyHint: false,
        idempotentHint: false,
      },
    };
  • Top-level registration of the html_deploy handler in the esaHandlers object used for MCP tool dispatching.
    export const esaHandlers: ToolHandlers = {
      site_active_list,
      site_match,
      site_route_list,
      site_record_list,
      routine_create,
      routine_code_commit,
      routine_delete,
      routine_list,
      routine_get,
      routine_code_deploy,
      routine_route_list,
      deployment_delete,
      route_create,
      route_delete,
      route_update,
      route_get,
      er_record_create,
      er_record_delete,
      er_record_list,
      html_deploy,
  • Inclusion of HTML_DEPLOY_TOOL in the ESA_OPENAPI_ER_LIST array for tool listing.
    export const ESA_OPENAPI_ER_LIST = [
      HTML_DEPLOY_TOOL,
Behavior3/5

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

Annotations indicate this is not read-only and not idempotent, which the description aligns with by implying a deployment action. The description adds value by specifying that it returns 'a default access URL,' providing context on output behavior. However, it lacks details on side effects, error handling, or rate limits, leaving gaps in behavioral understanding.

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 a single, well-structured sentence that efficiently conveys the core functionality and outcome. It's front-loaded with the main action and result, with no redundant or verbose language, making it easy to parse quickly.

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

Completeness3/5

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

Given the tool's moderate complexity (deployment action with 2 parameters) and lack of output schema, the description is minimally adequate. It covers the basic purpose and result but omits details on error cases, dependencies, or integration with sibling tools. With annotations providing some safety context, it meets a baseline level of completeness but could be more informative.

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

Parameters3/5

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

Schema description coverage is 100%, with clear documentation for both parameters ('name' and 'html'). The description doesn't add any semantic details beyond what the schema provides, such as explaining the relationship between parameters or usage nuances. Baseline score of 3 is appropriate since the schema adequately covers parameter information.

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

Purpose4/5

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

The description clearly states the action ('deploy an HTML page') and target resource ('ESA Edge Routine (ER)'), specifying what the tool does. However, it doesn't differentiate from sibling tools like 'routine_code_deploy' or 'routine_create', which appear related to similar deployment or routine management functions, leaving some ambiguity about when to choose this specific tool.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'routine_code_deploy' and 'routine_create' that likely handle similar tasks, there's no indication of prerequisites, scenarios, or exclusions. The phrase 'quickly deploy' implies a simple use case but offers no concrete decision criteria.

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/aliyun/mcp-server-esa'

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