Skip to main content
Glama

ambr_create_contract

Generate a Ricardian Contract from a template.

Creates a dual-format contract (human-readable legal text + machine-parsable JSON) using AI, linked by SHA-256 hash. The contract is stored on Ambr and accessible via the Reader Portal.

Requires a valid API key (X-API-Key header on the HTTP request) with available credits. Use ambr_list_templates first to discover templates and their required parameters.

Args:

  • template (string, required): Template slug (e.g. "d1-general-auth")

  • parameters (object, required): Template-specific parameters matching the schema

  • principal_declaration (object, required): { agent_id, principal_name, principal_type }

  • principal_wallet (string, optional): the deploying party's own wallet. It must differ from the counterparty wallet in parameters (same_wallet_both_parties otherwise); left out, the first wallet that signs fills the principal side

  • parent_contract_hash (string, optional): SHA-256 hash of a contract you created, which this one is created under (its oversight threshold then applies). Not for amendments: propose those with POST /api/v1/contracts/{id}/amend

  • oversight_threshold_usd (number, optional): spending level above which work created under this contract needs human approval. Children exceeding it halt at awaiting_principal_approval.

Returns:

  • contract_id: Unique ID (e.g. "amb-2026-0042")

  • sha256_hash: SHA-256 hash for verification

  • status: Contract status

  • reader_url: URL to view in Reader Portal

  • credits_remaining: Remaining API credits

Legibility: Output is dual-format by construction and replayable to the original SHA-256 hash — the basis of Ambr's legibility guarantee.

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": {
      "template": "<template>",
      "parameters": "<parameters>",
      "principal_declaration": "<principal_declaration>"
    },
    "name": "ambr_create_contract"
  }
}

Input Schema

NameRequiredDescriptionDefault
templateYesTemplate slug from ambr_list_templates
parametersYesTemplate-specific parameters
principal_walletNoThe deploying party's own wallet (0x…). Must differ from the counterparty wallet in parameters.
parent_contract_hashNoSHA-256 hash of a contract you created, which this one is created under. Amendments are proposed with POST /api/v1/contracts/{id}/amend, not here.
principal_declarationYes
oversight_threshold_usdNoSpending level above which work created UNDER this contract requires human approval. A child contract exceeding the parent threshold is held at awaiting_principal_approval until a human signs, and cannot be signed or activated before then (EU AI Act Art. 14).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • removedInput schema / properties / amendment_type
      Removed value: -{
      -  "enum": [
      -    "original",
      -    "amendment",
      -    "extension"
      -  ],
      -  "type": "string"
      -}
    • changedInput schema / properties / parent_contract_hash / description
      Previous value: -"SHA-256 hash of parent contract (for amendments)"New value: +"SHA-256 hash of a contract you created, which this one is created under. Amendments are proposed with POST /api/v1/contracts/{id}/amend, not here."
  2. Changed1 schema field changed
    • addedInput schema / properties / principal_wallet
      Added value: +{
      +  "description": "The deploying party's own wallet (0x…). Must differ from the counterparty wallet in parameters.",
      +  "type": "string"
      +}
  3. Changed1 schema field changed
    • addedInput schema / properties / oversight_threshold_usd
      Added value: +{
      +  "description": "Spending level above which work created UNDER this contract requires human approval. A child contract exceeding the parent threshold is held at awaiting_principal_approval until a human signs, and cannot be signed or activated before then (EU AI Act Art. 14).",
      +  "type": "number"
      +}
  4. First observed

TDQS

A4.5/5.0
Behavior4/5

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

Annotations declare a non-read-only, non-destructive, non-idempotent, closed-world mutation; the description goes well beyond that by disclosing the API-key/credit requirement, where the contract is stored and viewed (Ambr + Reader Portal), and the downstream state effect (children exceeding the threshold halt at awaiting_principal_approval). The one gap is that non-idempotency is never spelled out — nothing warns that repeated calls create duplicate contracts rather than returning the existing one.

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-loads purpose, then preconditions, then args, then returns — a predictable and scannable order. Some Arg entries largely restate the schema descriptions verbatim (template, parent_contract_hash), which is mild duplication, and the closing 'Legibility' paragraph is promotional rather than operational.

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?

With no output schema present, the explicit Returns block (contract_id, sha256_hash, status, reader_url, credits_remaining) is essential and supplied. Auth, credits, sibling routing, and child-contract side effects are covered; what is missing for a 6-parameter nested-object mutation is error behavior on template/parameter mismatch and whether retries are safe.

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 already 83%, so the baseline is 3; the description earns more by adding semantics the schema lacks — the default behavior when principal_wallet is omitted (first signing wallet fills the principal side), the named failure mode 'same_wallet_both_parties', and the inheritance rule that a parent's oversight threshold applies to children. It does not explain what happens when 'parameters' fails to match the template schema, which is the highest-risk input.

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 ('Generate a Ricardian Contract from a template') and immediately characterizes the output as dual-format (legal text + JSON linked by SHA-256). This clearly separates it from read-oriented siblings like ambr_get_contract and discovery tools like ambr_list_templates.

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 the agent: 'Use ambr_list_templates first to discover templates and their required parameters', and carves out an exclusion for parent_contract_hash ('Not for amendments: propose those with POST /api/v1/contracts/{id}/amend'). Both a prerequisite and a when-not-to-use case are named.

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