Skip to main content
Glama

deploy_function

Deploy serverless Node 22 functions to a project. Bundles npm dependencies at deploy time and supports cron schedule triggers.

Instructions

Deploy a serverless function (Node 22) to a project. Handler signature: export default async (req: Request) => Response. The function can import { db, adminDb, auth, email, ai } from '@run402/functions' — auto-bundled by the platform. Additional npm packages are bundled at deploy time when listed in deps (bare names resolve to latest; pinned/range specs are honored verbatim; @run402/functions and run402-functions rejected; max 30 entries; native binaries rejected). For schedule/email background triggers, prefer a unified deploy manifest with functions.replace.<name>.triggers[] so every trigger creates a durable function run. The response includes runtime_version (the bundled @run402/functions version — surface as 'Functions runtime version', never bare 'runtime'), deps_resolved (map of dep name → installed concrete version), and an optional top-level warnings array (sibling to the function record).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesTypeScript or JavaScript source code. Must export a default async function: export default async (req: Request) => Response
depsNoOptional npm package specs to install and bundle. Bare names (e.g. 'lodash') resolve to latest at deploy time; pinned (e.g. 'lodash@4.17.21') or range specs ('date-fns@^3.0.0') are honored verbatim. '@run402/functions' (auto-bundled) and 'run402-functions' (legacy name) are rejected. Max 30 entries, max 200 chars per spec. Native binary modules (sharp, canvas, native bcrypt, etc.) are rejected.
nameYesFunction name (URL-safe slug: lowercase, hyphens, alphanumeric, e.g. 'stripe-webhook')
configNoOptional function configuration
scheduleNoCron expression (5-field, e.g. '*/15 * * * *') to run the function on a schedule. Pass null to remove an existing schedule.
project_idYesThe project ID to deploy the function to
Behavior4/5

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

With no annotations, the description carries full burden. It discloses handler signature, bundled imports, dependency resolution rules (max entries, rejection of native binaries and @run402/functions), and response fields (runtime_version, deps_resolved, warnings). It does not mention authentication requirements, rate limits, or side effects beyond creation/ update, but the disclosed details are extensive and useful.

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

Conciseness4/5

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

The description is appropriately sized for the tool's complexity. It is front-loaded with the core purpose and progressively adds detail. Every sentence contributes value, though slightly longer than minimal. No redundancy or fluff.

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 6 parameters, no output schema, and no annotations, the description is fairly complete. It covers handler, dependencies, response, and special notes on schedule triggers. It lacks error handling details or failure modes, but the provided information is sufficient for an agent to invoke the tool correctly.

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?

Schema coverage is 100% (baseline 3). The description adds significant meaning: for 'deps', it explains bundling mechanics, rejection rules, and limits; for 'code', it provides exact handler signature; for 'schedule', it clarifies cron format and removal; for 'config', it notes default values. This goes well beyond the schema's descriptions.

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 'Deploy a serverless function (Node 22) to a project', specifying the verb (deploy), resource (serverless function), and context (Node 22, project). It distinguishes from siblings like list_functions, delete_function, and the generic deploy tool by focusing on function deployment with explicit handler and runtime details.

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 a guideline for schedule/email triggers ('prefer a unified deploy manifest'), but does not explicitly state when to use this tool versus alternative siblings (e.g., update_function, deploy, deploy_site). It lacks directives on when not to use it or comparison with other tools, leaving the agent without clear selection 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/kychee-com/run402-mcp'

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