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 commands/paypal/ai-toolkit/explain-errorgit clone --depth 1 https://github.com/paypal/AI-ToolkitWhat 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.00013 | $0.00702 |
| Opus 5 | $0.00006 | $0.00351 |
| Sonnet 5 | $0.00003 | $0.00140 |
| Haiku 4.5 | $0.00001 | $0.00070 |
Grade A, and why
explain-error 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 2d 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.
What it actually says
If "$ARGUMENTS" is empty, respond only with: "Please provide a PayPal error code or message. Example: /paypal:explain-error INSTRUMENT_DECLINED" and stop.
If "$ARGUMENTS" does not match any known PayPal error code or message pattern, respond with: "Unknown error code or message: $ARGUMENTS. This may be a typo, a third-party error, or a new PayPal error not yet in this reference. Check https://developer.paypal.com/api/rest/reference/orders/v2/errors/ for the full list." Then do your best to explain what the error string suggests based on its name, and stop — do not fabricate retry behavior or related errors.
Otherwise, explain the PayPal error "$ARGUMENTS". Provide:
- What it means — plain-language explanation
- Common causes — most likely reasons this occurs
- How to fix it — specific, actionable steps
- Code example — detect the user's programming language by scanning any open files with Read/Grep; default to Node.js if no language is found. Show proper error handling including how to catch the error, display a user-friendly message, and whether to retry.
- Related errors — only list errors from the Key error reference below that are meaningfully related (same HTTP status, same flow, or must be handled together). Do not suggest errors outside this list.
Key error reference:
INVALID_REQUEST(400) — malformed body or missing fields; inspect thedetails[]array for the specificfieldandissueUNAUTHORIZED(401) — expired or missing access token; refresh viaPOST /v1/oauth2/tokenNOT_AUTHORIZED(401) — valid token but missing scope for this operationPERMISSION_DENIED(403) — account not eligible for this API; check Developer Dashboard feature eligibilityRESOURCE_NOT_FOUND(404) — resource ID does not exist or belongs to a different accountDUPLICATE_TRANSACTION(409) — idempotency key already succeeded; retrieve the existing resource insteadINSTRUMENT_DECLINED(422) — buyer's payment method declined; ask for a different payment method, do not retry the same instrumentTRANSACTION_REFUSED(422) — risk engine decline; do not retry automaticallyORDER_ALREADY_COMPLETED(422) — cannot capture/authorize an already-completed orderAMOUNT_MISMATCH(422) — captured amount doesn't match authorized amountRATE_LIMIT_REACHED(429) — back off with exponential retry; honor theRetry-AfterheaderINTERNAL_SERVER_ERROR(500) — retry with the samePayPal-Request-Ididempotency key; logdebug_idPLAN_STATUS_INVALID— plan must beACTIVEbefore creating subscriptionsSUBSCRIPTION_STATUS_INVALID— subscription is not in a state that allows this operation
Always include the full error response body and debug_id when contacting PayPal support at https://developer.paypal.com/support/.
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.
- 2d ago First seen · 37 lines · 13 tokens per session scan A d35183b3f68a
explain-error is a command published in the GitHub repository paypal/AI-Toolkit (12 stars, last pushed 13d ago), licensed Apache-2.0. It adds 13 tokens to every session and 702 once invoked, about $0.0001 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 commands, from other repositories
group-chat
Create a multi-agent group chat with AG2 using configurable speaker selection patterns.
new-a2a-agent
Scaffold an A2A-compliant AG2 agent with server wiring, card settings, and skill definitions.
workflow-from-spec
Design a complete multi-agent workflow from a natural language description, selecting the right orchestration pattern.
new-tool
Create a tool function for an AG2 agent with type annotations, docstrings, and JSON return contracts.
new-agent
Scaffold a new AG2 ConversableAgent with tool functions, system prompt, and LLM config.
run-plan
Execute a PLAN.md file directly without loading planning skill context.