Give Claude custom tools changedagent-sdk/custom-tools
Nearest release: v2.1.311, published under an hour after upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Upstream edited this page at 26 Oct 2026 18:49 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 30 Oct 2026 18:07 UTC.
Upstream edited
Recorded here
Lines+30added
Lines−30removed
From line
38
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits17to this page, all time
The whole hunk
from line 38, old and new numbered
/
from line 38
3838
3939Python examples on this page that make HTTP requests use [httpx](https://www.python-httpx.org/). Add it with the package manager your project uses:
4040
41**Python (uv)**
41> [tab] Python (uv)
42>
43> ```bash theme={null}
44> uv add httpx
45> ```
4246
43```bash theme={null}
44uv add httpx
45```
47> [tab] Python (pip)
48>
49> ```bash theme={null}
50> pip install httpx
51> ```
4652
47**Python (pip)**
48
49```bash theme={null}
50pip install httpx
51```
52
5353### Weather tool example
5454
5555This example defines a `get_temperature` tool and wraps it in an MCP server, without passing the server to `query`. To run the tool, see [Call a custom tool](#call-a-custom-tool) below.
from line 194
194194
195195Combine this snippet with the tool and server definitions from the [weather tool example](#weather-tool-example) in one file, `weather.py` or `weather.ts`, then run it from your terminal:
196196
197**TypeScript**
197> [tab] TypeScript
198>
199> ```bash theme={null}
200> npx tsx weather.ts
201> ```
198202
199```bash theme={null}
200npx tsx weather.ts
201```
203> [tab] Python (uv)
204>
205> ```bash theme={null}
206> uv run weather.py
207> ```
202208
203**Python (uv)**
204
205```bash theme={null}
206uv run weather.py
207```
208
209**Python (pip)**
210
211Activate the virtual environment where you installed the SDK, then run:
212
213```bash theme={null}
214python weather.py
215```
209> [tab] Python (pip)
210>
211> Activate the virtual environment where you installed the SDK, then run:
212>
213> ```bash theme={null}
214> python weather.py
215> ```
216216
217217Claude calls `get_temperature` and the script prints a one-line answer with the current temperature in San Francisco.
218218
No line in this hunk matches that.