Skip to main content
Glama

agent_functions_create_code

Create a sandboxed Code function with saved tests, for logic the receptionist runs on live calls (calculations, lookups in fixed data). Read agent_functions_get_guide first for the main(input, context) contract. Required: name, description, instruction, codeLanguage, codeSource, inputSchema (root object field whose children are the arguments) and 1-25 codeTestCases. Checks plan capacity and returns upgrade_required when the plan has no room. Pass agentId to attach it once its tests pass. To call an outside URL use agent_functions_create_http instead; to change an existing function use agent_functions_update_code. Show the exact function name, receptionist, behaviour, active state, language and a summary of the code and tests, then get explicit confirmation before calling.

Input Schema

NameRequiredDescriptionDefault
nameYesFunction name the receptionist sees as a tool, e.g. "check_order_status".
agentIdYesOptional receptionist ID from listAgents to attach the function to right away.
isActiveYesWhether receptionists may call it. Default true.
codeSourceYesComplete source defining main(input, context) that returns the result; see agent_functions_get_guide for the contract and sandbox limits.
descriptionYesWhat the function does, in one or two plain sentences.
inputSchemaYesRoot input definition: a field of type "object" whose children are the arguments the receptionist passes (name, type, description, validations), e.g. {"name":"input","type":"object","children":[{"name":"orderNumber","type":"string","description":"Order number the caller gives"}]}.
instructionYesWhen and how the receptionist should call it on a live call, e.g. "Call when a caller asks where their order is; ask for the order number first."
codeLanguageYesLanguage of codeSource: PYTHON, JAVASCRIPT or TYPESCRIPT.
codeTestCasesYes1-25 tests run in the sandbox and saved with the function; it is attached to a receptionist only when all pass.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/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, closed-world; the description adds real behavioral context on top: the code runs sandboxed, plan capacity is checked and returns upgrade_required when there is no room, and the function is only attached to a receptionist when all saved tests pass. That failure mode and the attachment gating are not derivable from the annotations or schema.

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 purpose and scope are front-loaded and the guide pointer comes early, so the important routing information is not buried. It is slightly overstuffed, packing the alternatives, the confirmation workflow, and the required-field enumeration into one paragraph, but no sentence is pure filler.

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 9-required-parameter mutation tool with deep nested objects (inputSchema children, codeTestCases with context/call) and no output schema, the description covers prerequisites, required inputs, capacity failure, attachment semantics and confirmation. The only gap is that it says little about what a successful call returns beyond the upgrade_required case, which is partly mitigated by the get_guide reference.

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 explains every one of the 9 parameters. The description does add some meaning - that inputSchema is a root object whose children are the arguments, and that agentId attaches the function once tests pass - but it also restates the required-field list that the schema already enforces. This lands at the baseline for full coverage.

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 opens with a specific verb plus resource - 'Create a sandboxed Code function with saved tests' - and scopes it to 'logic the receptionist runs on live calls (calculations, lookups in fixed data)'. It also names the two sibling tools that handle adjacent cases, so an agent can distinguish this from create_http and update_code 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?

Explicit routing is given: 'To call an outside URL use agent_functions_create_http instead; to change an existing function use agent_functions_update_code', plus the prerequisite 'Read agent_functions_get_guide first for the main(input, context) contract'. It goes further and states the human-in-the-loop condition - enumerate the name, receptionist, behaviour, active state, language, code and test summary, then get explicit confirmation before calling.

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