agentsop-http-tool-wrapping
Decision protocol for wrapping a REST / GraphQL / RPC API as a tool an LLM agent can call. The load-bearing premise: the *tool surface* is an LM-friendly subset of the *API surface* — one tool per user intent, not one per endpoint. Activates when a coder agent must expose an external HTTP API to a model (function calling, tool_use, MCP, LangChain `@tool`, CrewAI `BaseTool`). Encodes the *what to surface, how to name, how to shape, how to fail* — not any single framework's API. ~80% of agent tools in production are HTTP wrappers; this is the SOP for getting them right.
npx skills add agentsope/SkillAlchemy --skill agentsop-http-tool-wrapping --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Guides turning an external HTTP API into an LM-friendly tool surface. Emphasizes one tool per user intent rather than one endpoint per tool, and provides criteria for when to activate, how to name and shape tools, how to flatten and type inputs, how to handle errors, pagination, authentication, idempotency, and framework bindings across multiple tool ecosystems.
How it works
Outlines activation triggers: when a coder agent must expose an external HTTP API to a model, or when selecting which endpoints to surface, or when existing tools return too much JSON or fail due to rate limits. Establishes core mental model: tool surface is a simplified, model-facing subset of the API; the surface includes a name, description, and a typed input schema. Provides a step-by-step workflow (OP-1 to OP-10) for triage, naming by intent, creating a typed input schema, injecting auth at the wrapper boundary, ensuring idempotency for mutations, and binding the framework across LangChain, CrewAI, MCP, OpenAI, and Anthropic.
Key steps include:
- Step 1: Triage endpoints to surfaced tools with intent labels, cap around 10.
- Step 2: Name by intent using verb_object format.
- Step 3: Flatten API params into a typed schema with description for each field.
- Step 4: Translate errors into a structured LM-readable JSON error object.
- Step 5: Shape output with a compact schema, including pagination surface when applicable.
- Step 6: Inject authentication at the wrapper boundary; no secrets in tool args.
- Step 7: Implement idempotency for mutating calls with per-operation keys.
- Step 4–10: Framework bindings and detailed SOP for error handling, pagination, and response shaping.
When to use it
Use when exposing a third-party or internal HTTP API to an LLM, deciding which endpoints should be tools, or when existing tools return too-large JSON or face rate limits, timeouts, or pagination issues. It also applies when porting the same tool across multiple tool ecosystems (OpenAI function calling, Anthropic tool_use, MCP, LangChain @tool, CrewAI BaseTool).
What it can touch
The skill prescribes how to design the tool surface and input/output schemas, error handling, and framework bindings. It does not enumerate specific implementation touches beyond the described SOP; exact touch points are determined by the defined steps (typed input schema, output model, error structure, idempotency header, and per-framework bindings).
Caveats
Cites multiple external sources for guidance and requires adherence to a typed input schema (no free-form kwargs), controlled error codes, and explicit authentication handling inside the wrapper. It cautions against mega-tools unless the API is genuinely uniform and emphasizes surface triage to avoid oversized tool catalogs. License: MIT.
# HTTP / External API → Agent Tool · SOP > Source posture: every non-trivial claim is cited inline with short tags like > `[oai/fc]`, `[anthropic/tooluse]`, `[lc/tools]`, `[mcp/spec]`, `[apxml/schema]`. > Resolve them against `references/R1-source-evidence.md` for full URLs. Reusable > code shapes live in `references/R2-pattern-library.md`. --- ## 1. 何时激活 (When to Activate) Activate when a coder agent must make an **external HTTP API callable by an LLM**. Concrete triggers: - The task says "give the agent access to <some API>", "add a tool that calls <service>", "wrap our REST/GraphQL/RPC endpoint as a function the model can use". - You are choosing which of N endpoints become tools, or how to name them. - An existing tool returns a huge JSON blob and the model hallucinates field names, or burns context re-reading it. - Tool calls die on `429`, timeouts, or unpaginated list endpoints. - You need the *same* tool to run under OpenAI function calling, Anthropic `tool_use`, an MCP server, LangChain `@tool`, and CrewAI `BaseTool`. **Do not activate** when: the API is already exposed as an MCP server you merely consume (just connect it); the "tool" is pure local computation with no netwo
- 1. 何时激活 (When to Activate)
- 2. 核心心智模型 (Core Mental Model)
- 3. SOP 工作流 (Standard Operating Procedure)
- Step 1 · Triage: which endpoints deserve to be tools?
- Step 2 · Name from intent
- Step 3 · Flatten params into a typed schema
- Step 4 · Error handling: translate, never leak
- Step 5 · Shape the output
- Step 6 · Auth & secrets at the wrapper boundary
- Step 7 · Idempotency on mutations
- 4. 操作模型 (Operation Models)
- OP-1 · Endpoint triage
- OP-2 · Name by intent
- OP-3 · Typed input schema
What does the agentsop-http-tool-wrapping skill do?
Decision protocol for wrapping a REST / GraphQL / RPC API as a tool an LLM agent can call. The load-bearing premise: the *tool surface* is an LM-friendly subset of the *API surface* — one tool per user intent, not one per endpoint. Activates when a coder agent must expose an external HTTP API to a model (function calling, tool_use, MCP, LangChain `@tool`, CrewAI `BaseTool`). Encodes the *what to surface, how to name, how to shape, how to fail* — not any single framework's API. ~80% of agent tools in production are HTTP wrappers; this is the SOP for getting them right.
How do I install it?
Run `npx skills add agentsope/SkillAlchemy --skill agentsop-http-tool-wrapping --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From agentsope/SkillAlchemy, a repository with 255 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
