To let an LLM use a tool, you define its signature using a JSON Schema. The LLM doesn't execute the code—it asks you to execute it.
{
"name": "get_weather",
"description": "Get the current weather in a given location.",
"input_schema": {
"type": "object",
"properties": {
"location": { "type": "string", "description": "City name" }
},
"required": ["location"]
}
}
tool_use intent (e.g., location="Tokyo").get_weather("Tokyo").tool_result message.