Skip to main content
Glama

Create event handler

create-event-handler

Define a rule that fires GL transactions when a matching event block is created with apply_handlers=True. Match criteria (event_type, event_category, match_source, match_agent_type, etc.) act as AND-joined filters — null fields match anything. The highest-priority matching handler wins. A handler created through an AI client is the AI's suggestion (suggested_by='ai'): it takes no part in matching until a person approves it in the app or the API.

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "name": "QB Vendor Bill — Default Expense Posting",
      "priority": 0,
      "event_type": "vendor_bill_received",
      "match_source": "quickbooks",
      "transaction_template": {
        "transactions": [
          {
            "entry_template": {
              "debit": {
                "amount": "{{ event.amount }}",
                "element_id": "elem_coa_office_supplies"
              },
              "credit": {
                "amount": "{{ event.amount }}",
                "element_id": "elem_coa_accounts_payable"
              }
            }
          }
        ]
      }
    },
    "name": "create-event-handler"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesHuman-readable handler name (unique per graph).
originNoProvenance of the handler. `tenant` = authored on this graph, the only value a caller may set; `hub` = platform-shipped template.tenant
metadataNoFree-form metadata stored alongside the handler.
priorityNoTiebreaker when multiple equally-specific handlers match. Higher = wins.
is_activeNoInactive handlers are ignored at match time.
event_typeYesEvent type to match. Matches the `event_type` field on incoming events from `create-event-block`.
descriptionNoFree-form description shown in admin UIs.
match_sourceNoMatch the event's `source` field (e.g. 'quickbooks', 'plaid'). Useful when the same event_type comes from multiple integrations.
event_categoryNoOptional category filter (e.g. 'expense', 'revenue').
match_agent_typeNoMatch agent-emitted events by agent_type.
match_resource_typeNoMatch resource-bound events by resource_type.
transaction_templateYesThe DSL spec for the GL rows this handler produces. See `TransactionTemplate` for the shape.
match_metadata_expressionNoJSONPath-style equality map against event.metadata, e.g. {"category": "payroll"} or {"metadata.category": "payroll"}

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

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

Beyond the annotations (readOnlyHint=false, destructiveHint=false, idempotentHint=false), the description discloses genuinely non-obvious behavior: null match fields match anything, handlers compete for precedence, and AI-authored handlers are inert suggestions (suggested_by='ai') until a human approves them. One caveat: it says 'the highest-priority matching handler wins,' while the schema says specificity wins with priority only as a tiebreaker — an internal inconsistency the agent should not rely on.

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?

Four sentences, front-loaded with purpose, then matching semantics, then the approval caveat — no filler. The only weakness is that the priority sentence compresses away the specificity-first rule documented in the schema, which trades accuracy for brevity.

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 create tool with deep nested objects and no output schema, the description covers the hard parts: match resolution and the AI-suggestion approval gate. It does not describe the return value or what happens to transaction_template expressions, but the schema documents the template DSL at length, so the remaining gaps are modest.

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%, so the baseline would be 3, but the description adds semantics the schema does not state as compactly: match fields are AND-joined filters and null means wildcard, plus the role of priority in tie-breaking. That meaningfully aids correct parameter selection for the match_* fields.

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 and resource: 'Define a rule that fires GL transactions when a matching event block is created.' It names the mechanism (event block + apply_handlers=True) and the deliverable (a rule/registry entry), which clearly separates it from get-event-handler, update-event-handler, and create-event-block.

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

Usage Guidelines3/5

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

It explains the firing condition (create-event-block with apply_handlers=True) and the AI-approval workflow, which implies when a created handler becomes live. However, it never says when to choose this tool over update-event-handler or preview-event-block, nor any when-not conditions. Usage is implied rather than prescribed.

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.