write-tool-schemas-a-model-wont-misuse
Use when exposing tools or functions to a model. Name and describe each parameter for the choosing model, constrain types and enums, and make side-effecting calls hard to invoke by accident.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- write-tool-schemas-a-model-wont-misuse
- description
- Use when exposing tools or functions to a model. Name and describe each parameter for the choosing model, constrain types and enums, and make side-effecting calls hard to invoke by accident.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md364 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Write tool schemas a model won't misuse
The model picks and fills tools from the schema alone — it never sees your implementation. Every ambiguous description becomes a wrong call.
Procedure
-
Name tools as
verb_nounand be specific:schedule_meeting, notdo_thing. Names blur together in the model's mind across a large registry. -
Write the description for the model, not for a human reader: when to use it, when not to, and what it returns. "Use for confirmed bookings only; returns the booking id."
-
Type every parameter and use enum/format wherever the space is closed.
{"name":"set_priority","parameters":{"type":"object",
"properties":{"level":{"type":"string","enum":["low","normal","high"]}},
"required":["level"],"additionalProperties":false}}
-
Mark required honestly; a parameter the model can omit is one it will omit randomly.
-
For destructive tools, require an explicit
confirmfield or adry_runboolean defaulting to true. -
Describe units and ranges in the field description: "amount in minor units (cents), integer > 0".
-
Keep parameters flat; deeply nested objects are mis-filled far more often than top-level scalars.
-
Test with the model: log every call's arguments and validate them against the schema and against intent before the real handler runs.
Pitfalls
- Vague descriptions ("updates the record") leave the model guessing which of two similar tools to call.
- Two tools that overlap in purpose; the model alternates between them unpredictably — merge or rename.
additionalPropertiesleft open lets the model invent fields your handler silently drops.- Stringly-typed enums (
"status": "string") produce typos and near-miss values that never match. - No required fields: the model returns a call that passes schema validation but does nothing.
Verification
python3 validate_calls.py calls.jsonl schema.json # every logged call validates; 0 schema failures
Report: "11 tools, all params typed with enums closed; replayed 200 logged calls, 0 schema violations and 0 ambiguous-tool choices after renaming the two overlapping write tools."
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.