Skip to main content
Glama

Add a custom function to the file

patchwork_add_custom_function

Create a FileMaker custom function from a formula and parameter names. Adds it as a new, reversible version and errors out if FileMaker rejects the formula or changes the parameters.

Instructions

Create a custom function from a formula and its parameter names. The version is dropped with an error if FileMaker rejected the formula or stored other parameters. To change an existing function, read it with patchwork_show and send it back with patchwork_replace. Makes a new version; patchwork_undo reverses it.

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": {
      "name": "<name>",
      "calc": "<calc>"
    },
    "name": "patchwork_add_custom_function"
  }
}

Input Schema

NameRequiredDescriptionDefault
calcYesFileMaker formula of the function. It can use the names given in params.
nameYesName of the new function, as calculations will call it.
paramsNoParameter names, in call order: ["amount", "rate"]. Default: no parameter.
dry_runNoOnly write the patch file to .patchwork/ and return its path. Nothing is applied, no version is made.
messageNoWhat this change does, kept in the version log. Default: a short description of the change.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

Annotations only declare it is a non-readonly, non-idempotent, non-destructive write. The description adds real behavioral context beyond that: the call makes a new version, patchwork_undo reverses it, and the version is dropped with an error if FileMaker rejected the formula or normalized the parameters. It does not say what is returned on success, but the mutation and rollback semantics are well covered.

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 the create action, then the failure mode, then the alternative for edits, then rollback. Every sentence carries information; the phrasing 'the version is dropped with an error' is slightly dense but not wasteful.

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 5-parameter mutation with full schema coverage and annotations, the description covers purpose, failure behavior, the edit alternative, and reversibility. The remaining gap is the absence of an output schema combined with no statement of what the call returns (e.g., version id or path), which an agent might want.

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 calc, name, params, dry_run and message are all documented in the schema itself. The description only alludes to params ('its parameter names') and to FileMaker rewriting parameters, adding little syntax or ordering detail beyond the schema, so baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Create a custom function from a formula and its parameter names.' The resource (custom function) is distinct from the add_field/add_script siblings, and it explicitly routes modification of an existing function to patchwork_replace, so an agent can separate the create path from the replace path.

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

Usage Guidelines4/5

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

Gives a clear alternative path: read the existing function with patchwork_show and send it back with patchwork_replace, which implicitly states when not to use this tool. It does not spell out prerequisites (e.g., whether the file must be open via patchwork_open), but the create-vs-modify split is unambiguous.

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