Skip to main content
Glama

routine_code_commit

Save code versions for Edge Routines to enable future modifications or releases within ESA services.

Instructions

Save a code version for future modifications or release within an Edge Routine (ER).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name of the routine, support lowercase English, numbers, and hyphens, must start with lowercase English, length cannot be less than 2 characters
descriptionNoDescription of the routine, no spaces
codeYesSource Code of the routine, export default { async fetch(request) { return handleRequest(request); } }

Implementation Reference

  • The main handler function that implements the routine_code_commit tool logic: retrieves upload info, uploads the code to OSS, and commits the staging code via API calls.
    export const routine_code_commit = async (request: CallToolRequest) => {
      const res = await api.getRoutineStagingCodeUploadInfo(
        request.params.arguments as GetRoutineStagingCodeUploadInfoRequest,
      );
      if (!res) {
        return {
          content: [
            {
              type: 'text',
              text: `Failed to get routine staging code upload info. ${JSON.stringify(res)}`,
            },
          ],
          success: false,
        };
      } else {
        const uploadRes = await uploadCodeToOSS(
          res,
          request?.params?.arguments?.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 {
            return {
              content: [
                {
                  type: 'text',
                  text: JSON.stringify(commitRes),
                },
              ],
              success: true,
            };
          }
        }
      }
    };
  • The tool definition including name, description, and input schema for validating parameters: name, description (optional), code (required).
    export const ROUTINE_CODE_COMMIT_TOOL: Tool = {
      name: 'routine_code_commit',
      description:
        'Save a code version for future modifications or release within an Edge Routine (ER).',
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description:
              'The name of the routine, support lowercase English, numbers, and hyphens, must start with lowercase English, length cannot be less than 2 characters',
          },
          description: {
            type: 'string',
            description: 'Description of the routine, no spaces',
          },
          code: {
            type: 'string',
            description:
              'Source Code of the routine, export default { async fetch(request) { return handleRequest(request); } }',
          },
        },
        required: ['name', 'code'],
      },
    };
  • ROUTINE_CODE_COMMIT_TOOL is registered in the ESA_OPENAPI_ER_LIST array, which collects tools for ER operations.
    export const ESA_OPENAPI_ER_LIST = [
      HTML_DEPLOY_TOOL,
      ROUTINE_CREATE_TOOL,
      ROUTINE_DELETE_TOOL,
      ROUTINE_LIST_TOOL,
      ROUTINE_GET_TOOL,
      ROUTINE_CODE_COMMIT_TOOL,
      ROUTINE_CODE_DEPLOY_TOOL,
      ROUTINE_ROUTE_LIST_TOOL,
      DEPLOYMENT_DELETE_TOOL,
      SITE_ACTIVE_LIST_TOOL,
      SITE_ROUTE_LIST_TOOL,
      ROUTE_CREATE_TOOL,
      ROUTE_DELETE_TOOL,
      ROUTE_UPDATE_TOOL,
      ROUTE_GET_TOOL,
      SITE_MATCH_TOOL,
      ER_RECORD_CREATE_TOOL,
      ER_RECORD_DELETE_TOOL,
      ER_RECORD_LIST_TOOL,
    ];
  • The routine_code_commit handler is registered in the esaHandlers object mapping tool names to their handler functions.
    routine_code_commit,
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states 'Save a code version', implying a write operation that persists code, but doesn't disclose behavioral traits like whether this overwrites existing versions, requires specific permissions, has rate limits, returns a version ID, or what happens on failure. For a mutation tool with zero annotation coverage, this is 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 a single, efficient sentence that front-loads the core purpose ('Save a code version') and adds context ('for future modifications or release within an Edge Routine'). Every word earns its place with zero waste, making it appropriately sized for the tool's complexity.

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

Completeness2/5

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

Given no annotations, no output schema, and a mutation tool with 3 parameters, the description is incomplete. It doesn't cover behavioral aspects (e.g., idempotency, error handling), output format, or usage context. For a tool that saves code versions—a potentially complex operation—this lacks necessary detail for an agent to use it confidently.

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%, so the schema already documents all three parameters (name, description, code) with their types, constraints, and examples. The description adds no parameter-specific information beyond what's in the schema, such as explaining relationships between parameters or usage nuances. Baseline 3 is appropriate when schema does the heavy lifting.

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 ('Save a code version') and resource ('within an Edge Routine'), specifying it's for 'future modifications or release'. It distinguishes from obvious siblings like 'routine_code_deploy' (which likely deploys rather than saves) and 'routine_create' (which likely creates rather than saves versions). However, it doesn't explicitly differentiate from all siblings, keeping it at 4 rather than 5.

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 like 'routine_code_deploy' (for deployment) or 'routine_create' (for initial creation). It mentions 'future modifications or release' but doesn't specify prerequisites, timing, or exclusions. Without explicit when/when-not instructions, this scores 2.

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