Skip to main content
Glama

Deploy code that runs on an app's events

anyhook_code_deploy
Destructive

Save a handler that runs on every event this app receives, in an isolated sandbox, with AnyHook's retries and replay around it: no server of your own. Each run's console output and return value are stored as that delivery's response (anyhook_inspect shows them). It can also run on a cron schedule. Pro and Scale; runs are capped per month with no overage, retries, test runs and schedule firings each count, and each run and package install is charged to the monthly compute allowance (anyhook_usage shows both). anyhook_code_test runs it on a stored event. Secrets (env.NAME) are set by the user on the app's dashboard page, under Code: this tool takes none, so never write a key into the code; anyhook_code_get lists the names set.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "appSlug": "<appSlug>",
      "code": "<code>"
    },
    "name": "anyhook_code_deploy"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesAn ES module, run in a sandboxed Node.js on every event this app receives. Either `export default async function (event, { env }) {}` (event: { method, headers, body, raw_body, delivery_id, attempt }; method is always POST, and the query string, path and caller IP are not kept) or a Pipedream Node.js code step: `export default defineComponent({ async run({ steps, $ }) {} })`, where steps.trigger.event is that same event (a step reading query, path, url or client_ip needs changing) and $.export and $.flow.exit work. npm packages it imports are installed on deploy (pin as "pkg@1.2.3", like Pipedream; a new package list usually takes seconds, a large one a few minutes). @pipedream/platform is a stand-in. State between events: the app's store (store.get/set/has/delete/keys, set takes { ttl }); every data_store prop is that one store, an app prop's this.<prop>.$auth.<field> reads the secret <APP>_<FIELD>, any other prop the secret named after it (channelId → CHANNEL_ID). Throwing fails the delivery, which AnyHook retries. Templates for common actions (Slack, email, Google Sheets, Notion, Claude and more): https://anyhook.net/code-templates.md
appSlugYesThe app whose events the code runs on.
enabledNoWhether events run the code. false saves it switched off, so it runs only through anyhook_code_test. Omit: a first deploy goes live and later deploys keep the current state. If another system still handles the same events while this is on, both act on each one.
scheduleNoAlso run on a cron schedule: five fields, UTC unless prefixed CRON_TZ=Area/City, e.g. "*/15 * * * *". Each firing arrives as an anyhook.schedule event and counts as a run. null removes it; omit to keep it. Only on an app that does not verify a sender's signature.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • removedInput schema / properties / secrets
      Removed value: -{
      -  "additionalProperties": {
      -    "type": [
      -      "string",
      -      "null"
      -    ]
      -  },
      -  "description": "Environment variables for the code, read as env.NAME or process.env.NAME. Merged into the saved ones; null removes a name.",
      -  "propertyNames": {
      -    "type": "string"
      -  },
      -  "type": "object"
      -}
  2. Changed1 schema field changed
    • changedInput schema / properties / enabled / description
      Previous value: -"Whether events run the code. false saves it switched off, so it runs only through anyhook_code_test. Omit: a first deploy goes live and later deploys keep the current state. Deploy off while another system still handles the same events, or both will act on each one."New value: +"Whether events run the code. false saves it switched off, so it runs only through anyhook_code_test. Omit: a first deploy goes live and later deploys keep the current state. If another system still handles the same events while this is on, both act on each one."
  3. Changed2 schema fields changed
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / secrets / propertyNames
      Added value: +{
      +  "type": "string"
      +}
  4. Changed1 schema field changed
    • removedInput schema / properties / api_key
      Removed value: -{
      -  "description": "API key (ahk_live_...) from anyhook_quickstart. Only needed over HTTP when no Authorization header is set; ignored over stdio.",
      -  "type": "string"
      -}
  5. Changed1 schema field changed
    • changedInput schema / properties / code / description
      Previous value: -"An ES module, run in a sandboxed Node.js on every event this app receives. Either `export default async function (event, { env }) {}` (event: { method, headers, body, raw_body, delivery_id, attempt }) or a Pipedream code step as written: `export default defineComponent({ async run({ steps, $ }) {} })` with steps.trigger.event, $.export and $.flow.exit. npm packages it imports are installed on deploy (pin as \"pkg@1.2.3\", like Pipedream; a new package list takes up to a minute). @pipedream/platform is a stand-in. State between events: the app's store (store.get/set/has/delete/keys, set takes { ttl }); a step's data_store prop is the same store, an app prop's this.<prop>.$auth.<field> reads the secret <APP>_<FIELD>, any other prop the secret named after it (channelId → CHANNEL_ID). Throwing fails the delivery, which AnyHook retries. Templates for common actions (Slack, email, Google Sheets, Notion, Claude and more): https://anyhook.net/code-templates.md"New value: +"An ES module, run in a sandboxed Node.js on every event this app receives. Either `export default async function (event, { env }) {}` (event: { method, headers, body, raw_body, delivery_id, attempt }; method is always POST, and the query string, path and caller IP are not kept) or a Pipedream Node.js code step: `export default defineComponent({ async run({ steps, $ }) {} })`, where steps.trigger.event is that same event (a step reading query, path, url or client_ip needs changing) and $.export and $.flow.exit work. npm packages it imports are installed on deploy (pin as \"pkg@1.2.3\", like Pipedream; a new package list usually takes seconds, a large one a few minutes). @pipedream/platform is a stand-in. State between events: the app's store (store.get/set/has/delete/keys, set takes { ttl }); every data_store prop is that one store, an app prop's this.<prop>.$auth.<field> reads the secret <APP>_<FIELD>, any other prop the secret named after it (channelId → CHANNEL_ID). Throwing fails the delivery, which AnyHook retries. Templates for common actions (Slack, email, Google Sheets, Notion, Claude and more): https://anyhook.net/code-templates.md"
  6. Changed1 schema field changed
    • changedInput schema / properties / code / description
      Previous value: -"An ES module, run in a sandboxed Node.js on every event this app receives. Either `export default async function (event, { env }) {}` (event: { method, headers, body, raw_body, delivery_id, attempt }) or a Pipedream code step as written: `export default defineComponent({ async run({ steps, $ }) {} })` with steps.trigger.event, $.export and $.flow.exit. npm packages it imports are installed on deploy (pin as \"pkg@1.2.3\", like Pipedream; a new package list takes up to a minute). @pipedream/platform is a stand-in. State between events: the app's store (store.get/set/has/delete/keys, set takes { ttl }); a step's data_store prop is the same store, an app prop's this.<prop>.$auth.<field> reads the secret <APP>_<FIELD>, any other prop the secret named after it (channelId → CHANNEL_ID). Throwing fails the delivery, which AnyHook retries."New value: +"An ES module, run in a sandboxed Node.js on every event this app receives. Either `export default async function (event, { env }) {}` (event: { method, headers, body, raw_body, delivery_id, attempt }) or a Pipedream code step as written: `export default defineComponent({ async run({ steps, $ }) {} })` with steps.trigger.event, $.export and $.flow.exit. npm packages it imports are installed on deploy (pin as \"pkg@1.2.3\", like Pipedream; a new package list takes up to a minute). @pipedream/platform is a stand-in. State between events: the app's store (store.get/set/has/delete/keys, set takes { ttl }); a step's data_store prop is the same store, an app prop's this.<prop>.$auth.<field> reads the secret <APP>_<FIELD>, any other prop the secret named after it (channelId → CHANNEL_ID). Throwing fails the delivery, which AnyHook retries. Templates for common actions (Slack, email, Google Sheets, Notion, Claude and more): https://anyhook.net/code-templates.md"
  7. Changed1 schema field changed
    • changedInput schema / properties / code / description
      Previous value: -"An ES module, run in a sandboxed Node.js on every event this app receives. Either `export default async function (event, { env }) {}` (event: { method, headers, body, raw_body, delivery_id, attempt }) or a Pipedream code step as written: `export default defineComponent({ async run({ steps, $ }) {} })` with steps.trigger.event, $.export and $.flow.exit. npm packages it imports are installed on deploy (pin as \"pkg@1.2.3\", like Pipedream; a new package list takes up to a minute). @pipedream/platform is a stand-in. Throwing fails the delivery, which AnyHook retries."New value: +"An ES module, run in a sandboxed Node.js on every event this app receives. Either `export default async function (event, { env }) {}` (event: { method, headers, body, raw_body, delivery_id, attempt }) or a Pipedream code step as written: `export default defineComponent({ async run({ steps, $ }) {} })` with steps.trigger.event, $.export and $.flow.exit. npm packages it imports are installed on deploy (pin as \"pkg@1.2.3\", like Pipedream; a new package list takes up to a minute). @pipedream/platform is a stand-in. State between events: the app's store (store.get/set/has/delete/keys, set takes { ttl }); a step's data_store prop is the same store, an app prop's this.<prop>.$auth.<field> reads the secret <APP>_<FIELD>, any other prop the secret named after it (channelId → CHANNEL_ID). Throwing fails the delivery, which AnyHook retries."
  8. Changed1 schema field changed
    • changedInput schema / properties / code / description
      Previous value: -"An ES module, run in a sandboxed Node.js on every event this app receives. Either `export default async function (event, { env }) {}` (event: { method, headers, body, raw_body, delivery_id, attempt }) or a Pipedream code step as written: `export default defineComponent({ async run({ steps, $ }) {} })` with steps.trigger.event, $.export and $.flow.exit. fetch is global; `axios` and `@pipedream/platform` are fetch-based stand-ins; no other package is installed. Throwing fails the delivery, which AnyHook retries."New value: +"An ES module, run in a sandboxed Node.js on every event this app receives. Either `export default async function (event, { env }) {}` (event: { method, headers, body, raw_body, delivery_id, attempt }) or a Pipedream code step as written: `export default defineComponent({ async run({ steps, $ }) {} })` with steps.trigger.event, $.export and $.flow.exit. npm packages it imports are installed on deploy (pin as \"pkg@1.2.3\", like Pipedream; a new package list takes up to a minute). @pipedream/platform is a stand-in. Throwing fails the delivery, which AnyHook retries."
  9. Changed1 schema field changed
    • addedInput schema / properties / enabled
      Added value: +{
      +  "description": "Whether events run the code. false saves it switched off, so it runs only through anyhook_code_test. Omit: a first deploy goes live and later deploys keep the current state. Deploy off while another system still handles the same events, or both will act on each one.",
      +  "type": "boolean"
      +}
  10. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already flag destructive=true, readOnly=false and openWorld=true, and the description still adds substantial context beyond them: sandbox isolation, built-in retries and replay, that each run's console output and return value become the delivery's stored response, and that throwing fails the delivery. It also discloses hard operational limits — Pro/Scale only, monthly run caps with no overage, retries/test runs/schedule firings each counting, and compute-allowance charging visible in anyhook_usage — plus the key auth constraint that env secrets are never passed as parameters.

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

Conciseness3/5

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

The core purpose is front-loaded in the first sentence, but the text then becomes a single dense run-on of parentheticals, billing details (plan tiers, monthly allowance, charge accounting) and cross-references packed into roughly 150 words. Much of that is valuable, yet the billing and allowance clauses could be compressed or deferred to anyhook_usage without losing the agent's ability to call the tool correctly.

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?

For a destructive, open-world deploy with four fully documented parameters and no output schema, the description covers nearly everything: what the code runs against, retries/replay behavior, where run output is stored and how to inspect it, scheduling semantics, and the secrets model. The one omission is what the deploy call itself returns (e.g., a version or deployment identifier), though the pointer to anyhook_inspect mitigates that.

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% and the schema descriptions are unusually rich (code module shapes, npm pinning, store semantics), so the schema does most of the work. The description still adds meaning the schema does not: that the tool accepts no secrets itself, that env.NAME values are user-set on the dashboard, and that anyhook_code_get enumerates them — a real behavioral constraint on the code parameter.

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 opening clause states a specific verb and resource — save a handler that runs on every event an app receives, in an isolated sandbox — and immediately scopes it against siblings by noting the output is visible via anyhook_inspect and testable via anyhook_code_test. An agent can distinguish this deploy tool from anyhook_code_get, anyhook_code_test and anyhook_inspect without opening a schema.

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

Usage Guidelines5/5

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

It routes explicitly: use anyhook_code_test to run against a stored event, use anyhook_code_get to list secret names, use anyhook_inspect to see stored outputs, and set secrets on the dashboard because 'this tool takes none.' The schedule parameter also carries a concrete exclusion ('only on an app that does not verify a sender's signature'), and the enabled note warns that a concurrent handler will double-act on events.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.