Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/konghayao/peri/programmatic-tool-callingnpx skills add KonghaYao/peri --skill programmatic-tool-callinggit clone --depth 1 https://github.com/KonghaYao/periWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/konghayao/peri/programmatic-tool-calling)<a href="https://agentmods.dev/skills/konghayao/peri/programmatic-tool-calling"><img src="https://agentmods.dev/badge/skills/konghayao/peri/programmatic-tool-calling.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00033 | $0.00662 |
| Opus 5 | $0.00016 | $0.00331 |
| Sonnet 5 | $0.00007 | $0.00132 |
| Haiku 4.5 | $0.00003 | $0.00066 |
Grade A, and why
programmatic-tool-calling scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 38 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Programmatic Tool Calling
This builtin skill is named programmatic-tool-calling and keeps the generic alias ptc, so users may invoke it as /ptc.
Use this skill when a task benefits from discovering extra tools and orchestrating several dependent or repetitive calls in one bounded program. It is especially useful for filtering, joining, or summarizing structured tool results without copying large intermediate payloads into the conversation.
Do not use it for a single ordinary tool call, when the required tool is already directly available, for interactive workflows that need user input between steps, or to bypass an approval or access-control boundary.
Workflow
- Call
SearchExtraToolsto locateRunPtcCodeand every deferred tool the program needs, and inspect their schemas. - Invoke canonical deferred target
RunPtcCodethroughExecuteExtraToolwith a small ESM program that invokes the discovered tools, checks results, and returns only the JSON-compatible data needed by the task. - Use
ExecuteExtraTooldirectly instead when no program is needed, or to validate another discovered tool before composing it.
The PTC entry pattern is SearchExtraTools → ExecuteExtraTool(RunPtcCode). RunPtcCode is not a direct tool; existing direct tools remain unchanged. The old run_code name is only a search migration keyword, not an executable alias. Never guess an extra tool name or input schema.
Code and result constraints
- Code runs in an ESM-only function body. Load Node modules only with dynamic
await import("node:..."); staticimportstatements and CommonJSrequire/module.exportsare unavailable. - Inputs, intermediate tool arguments, and the final return value must be JSON-compatible: objects, arrays, strings, numbers, booleans, or
null. Do not return functions, classes, cyclic values, streams, or binary handles. - Keep programs bounded. Limit tool-call count, loop iterations, concurrency, output size, and retained intermediate data. Prefer projection and aggregation over returning raw bulk responses.
- Handle missing fields and tool errors explicitly. Return a compact structured error rather than retrying indefinitely.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 38 lines · 33 tokens per session scan A fef5bfdfdd49
programmatic-tool-calling is a skill published in the GitHub repository KonghaYao/peri (159 stars, last pushed today), licensed Apache-2.0. It adds 33 tokens to every session and 662 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
qa-testing
Verify your work by actually operating the app or website you changed, instead of assuming it works. Strongly recommended whenever you build, modify, or debug a web app, website, or desktop GUI app. Drive real browsers with the agent-browser CLI and native desktop apps with the cua-driver CLI. These are installed on…
plugin-creator
Create and scaffold plugin directories for Codex with a required .codex-plugin/plugin.json, optional plugin folders/files, valid manifest defaults, and personal-marketplace entries by default. Use when Codex needs to create a new personal plugin, add optional plugin structure, generate or update marketplace entries…
imagegen
Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…
babysit-pr
Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…
skill-creator
Create or update a Codex skill with appropriately scoped instructions and any needed supporting resources.
codex-pr-body
Update the title and body of one or more pull requests.