Skip to main content

How to use tools in PromptHub

Dan Cleary avatar
Written by Dan Cleary
Updated over a week ago

PromptHub’s Tool Use feature lets you create tools that the model can call and gives you a built‑in UI to mock the responses—all without leaving the Playground.


Tool Use basics (read this first)

  • A tool is just a function you describe in JSON (name, description, parameters). Each provider has their own way of handling tools, make sure to check their documentation.

  • Mocks, not live calls. In the Playground you simulate the response—you’re not hitting any external API yet. This makes it easy to iterate very quickly.

  • Chat first. You can attach tools to Completion prompts, but 90 % of the time you’ll test them inside a Chat project so you can watch the request/response loop.

  • Version‑controlled. Tool schemas are versioned just like how your prompts are.


Quick start tutorial

Total time: ~3 minutes

Step 1 – Create (or pick) a tool

  1. Open a Chat project and click Tools (underneath the parameters) → New Tool.

  2. Choose a template like get_weather or create your own.

  3. Fill out the JSON schema. Tip: start with a template so the JSON structure is guaranteed valid.

Step 2 – Test in the Chat section

In the User message box, type something the tool can solve. For example, if we have the get_weather tool enabled we could ask something like

What’s the weather in New York City?

Press Send to send the message.

The model should recognize that your question involves weather data and call the tool.

Step 3 – Mock the response

A dialog pops up that will show the tool name and arguments. Beneath you'll see a text box for the Mock Result. Enter a realistic payload—e.g.

{   "temperature": "67°F",   "condition": "Partly Cloudy" }

Hit Send. PromptHub feeds this mock back to the model, which then produces the final answer:

Step 4 – Commit & compare (optional)

Just like any other prompt test, you can

  • Commit your chat template by using the "Commit immediately" button. This will save any messages in the template as well as the tools you've created and attached.

  • Use the compare with button at the top of the playground to compare prompt revisions side‑by‑side which can have different tool versions.


Best practices

  • Verb‑first names. get_Weather, search_products > WeatherTool.

  • Keep parameters minimal. Only include what the model truly needs to decide.

  • Write a crystal‑clear description. The model picks tools based on the description text. The more info the better.

  • Mock like production. Use real‑looking data and edge‑case values.


Troubleshooting

Symptom

Fix

Model ignores the tool

Check the description—is it explicit enough? Confirm the tool is attached and enabled.

Wrong arguments

Adjust your examples so the model sees the correct shape.


FAQ

Q. Can I hit live APIs instead of mocking?
Not in the playground. In production you’ll handle the tool‑call webhooks yourself and pass the real response back. The Playground sticks to mocks for safety.

Q. Is Tool Use available on the free plan?
Absolutely.

Q. Can I retrieve the tools in a project when I use the PromptHub API for retrieval?
Yes, the tools will be in the response when retrieving a prompt.


Did this answer your question?