When a chat application needs to execute code, query a database, or connect to Acme Corp's internal APIs, it uses function calling. But mapping APIs to OpenAI's strict schema by hand is tedious and error-prone. wmcp.sh dynamically compiles these schemas for you.
Function calling—introduced by OpenAI—allows developers to pass an array of available tools in the tools array of a chat completion request. The model then intelligently decides which function to invoke, providing the necessary JSON arguments.
However, handling the lifecycle of these calls is difficult. Models now support parallel tool calls, meaning the model might ask to execute three functions simultaneously. Your infrastructure must securely hold credentials, execute the network requests, and manage retries. wmcp.sh acts as an execution gateway that handles this automatically, utilizing an encrypted credentials vault for static keys to keep your environment secure. (Note: wmcp.sh is not affiliated with OpenAI, Anthropic, or any other mentioned orgs.)
import OpenAI from "openai";
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
// Fetch dynamic tool schemas from wmcp.sh rather than hardcoding
const toolSchemas = await fetch("https://api.wmcp.sh/v1/tools?provider=openai").then(r => r.json());
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Fetch the latest logs." }],
tools: toolSchemas,
tool_choice: "auto"
});
// Inspect the model's decision
const toolCalls = response.choices[0].message.tool_calls;
if (toolCalls) {
for (const call of toolCalls) {
console.log("OpenAI requested function:", call.function.name);
// In production, wmcp.sh executes these in parallel
}
}
| Capability | Without wmcp.sh | With wmcp.sh |
|---|---|---|
| Parallel Execution | ⚠️ Requires custom Promise.all() wiring. | ✅ Handled concurrently at the edge. |
| Schema Generation | ❌ Manually written JSON Schema types. | ✅ Auto-generated from OpenAPI. |
| Performance | ⚠️ Cloud provider routing overhead. | ✅ Sub-100ms latency execution. |
| Caching | ❌ Duplicate queries sent to your DB. | ✅ Short TTL (~1s) deduplication cache. |
In the OpenAI API, "functions" are a specific type of "tool". Currently, function calling is the primary tool type, so the terms are often used interchangeably, though the API expects a wrapper object of type 'function'.
It dictates behavior. 'none' disables function calling, 'auto' lets the model choose, and specifying a precise function name forces the model to generate arguments for that specific function.
While OpenAI relies on the 'tool_calls' array attached to the message object, Anthropic uses 'tool_use' blocks embedded directly within the message content array. Both achieve the same result. wmcp.sh normalizes both formats seamlessly.
Uncached parallel function calls can quickly hit target API rate limits. wmcp.sh utilizes a short TTL caching layer (~1s) to collapse duplicate requests in the same reasoning loop.
Custom adapter + hosted MCP at mcp.yourbrand.com + verified badge. Pricing: Starter $499 one-time, Managed Retainer $999/mo, or Enterprise $4,999+/mo.