mcp tools

Turn your function into a tool an agent can call

Below is a shipping-cost function you already wrote — it works. But an agent never sees your code. All it sees is the tool’s name and description. Make them vague and the agent guesses the price (and can’t know your rate table); make them clear and the same function gets called and the figure is exact. Same code, different metadata, opposite outcome — then save it as a tool a chat can use.

the metadata the model sees

Nothing here says shipping or cost — the model can't tell this is what it needs, so it guesses.

the session — what the customer got

How much will it cost to ship a 7 kg parcel to Japan?

true cost (your function): $132

Pick a description, then ask the agent.

the wire — all the model sees of your tool
name: calc
description: Does a calculation.
inputSchema: weight_kg: number, country: string

No code, no formula, no rate table — just these three fields decide whether the agent reaches for it.

estimate_shipping(7, "Japan")

Saving registers this as an artifact a chat agent can call — the bridge into the composition core.