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,

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