Skip to main content
Glama
Replaced by its MCP Registry listing

This endpoint is listed in the official MCP Registry as AALY. If you published it, claim ownership there.

create_function

Define a Function: customer Python that runs on an entity's request lifecycle. This creates METADATA ONLY and deploys nothing — the code comes from the project's bundle, uploaded separately and deployed with deploy_functions.

Read the aaly://platform/functions resource before your first one: it has the payload contract, the repo layout handler paths point into, and runnable examples.

Four axes decide behaviour. trigger_point: before-request can rewrite the payload or reject the request outright; after-request sees the response; endpoint IS the response for a custom-endpoint route (see create_endpoint) rather than wrapping a CRUD operation at all. execution_mode: synchronous blocks the request and shares the trigger's whole-chain budget (2s before, 5s after, 25s for a synchronous endpoint, which stays under API Gateway's 29s timeout); asynchronous is fire-and-forget (5 min budget) with failures visible only in CloudWatch. methods: which HTTP verbs trigger it — irrelevant for trigger_point 'endpoint', where the method lives once on the endpoint record itself. order: Functions on the same trigger run lowest-first in ONE invocation, each receiving the previous one's output.

Metadata edits take effect within 30s with no redeploy — only changing the code bundle requires deploy_functions.

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": {
      "entity_id": "<entity_id>",
      "name": "<name>",
      "trigger_point": "<trigger_point>"
    },
    "name": "create_function"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesLowercase identifier, unique within the project, e.g. 'validate_order'. Immutable once created.
labelNo
orderNoExecution order within the trigger point, lowest first. Default 100, which leaves room to insert ahead of an existing Function.
enabledNoDefaults to true. Disabling takes effect within 30s with no redeploy.
handlerNoDotted path into the code bundle, e.g. 'orders.before.validate'. Defaults to '{name}.handler'.
methodsNoHTTP methods that trigger this Function. Defaults to all four. Ignored for trigger_point 'endpoint' — the method lives once on the endpoint record.
entity_idYesWhat this Function attaches to: an entity record ID (e.g. 'ENT7') for trigger_point before-request/after-request, or a custom endpoint's id (e.g. 'EPT3', from create_endpoint) for trigger_point 'endpoint'. Must resolve to the right kind for the declared trigger_point, and must belong to the same project.
project_idNoProject record ID (e.g. 'PRJ3'). Get it from whoami or list_projects.
timeout_msNoPer-Function ceiling, capped by the trigger's whole-chain budget.
descriptionNoWhat this Function does — surfaced to agents reading the project's capabilities.
trigger_pointYesImmutable — the payload contract differs entirely between them. 'endpoint' requires entity_id to be a custom endpoint's id, not a real entity's.
error_handlingNofail aborts the chain and rejects the request; log/ignore continue. Forced to fail for synchronous before-request Functions, which exist to be gates.
execution_modeNoDefaults to synchronous. Ignored for trigger_point 'endpoint' — set execution_mode on the endpoint itself (create_endpoint/update_endpoint) instead, since a route's sync/async behaviour is one property of the whole route, not of any one attached Function.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / project_id / description
      Previous value: -"Project record ID (e.g. 'PRJ3'). Optional if whoami returned a default_project_id."New value: +"Project record ID (e.g. 'PRJ3'). Get it from whoami or list_projects."
  2. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare non-read-only, non-destructive, non-idempotent; the description goes far beyond by disclosing that nothing is deployed, that changes propagate in 30s without redeploy, that before-request can reject a request outright, and that asynchronous failures are visible only in CloudWatch. The one-invocation chaining semantics (lowest order first, each receiving the previous output) is behavior an agent could not infer from any structured field.

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?

Front-loaded with the most decision-critical fact (metadata only, nothing deployed) before the resource pointer and the four behavior axes. It is dense and readable, though the endpoint caveats for methods and execution_mode restate what the schema descriptions already say, costing a little length.

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 13-parameter mutation tool with no output schema, the description covers the deployment relationship, propagation timing, the four behavior axes, and the prerequisite resource. The only real gap is that it never hints at what the call returns (presumably the created Function record), which matters somewhat given no output schema exists.

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 92% and the schema already documents most parameters well, but the description adds genuine cross-parameter meaning: methods is irrelevant for 'endpoint' because the verb lives on the endpoint record, execution_mode is ignored for 'endpoint' for the same reason, and order describes intra-trigger chaining rather than mere sequencing. These interactions are not derivable from per-parameter schema text alone.

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?

States a specific verb and resource ('Define a Function ... Python that runs on an entity's request lifecycle') and immediately scopes it as metadata-only, explicitly naming deploy_functions as the thing that ships code. An agent can distinguish it from deploy_functions, create_endpoint, and update_function without opening any 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?

Explicitly routes: read the aaly://platform/functions resource before the first call, code comes from the bundle and is deployed via deploy_functions, and trigger_point 'endpoint' involves create_endpoint. It also gives the condition under which metadata edits apply (30s, no redeploy) versus when a redeploy is required.

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.

Resources