Commit a7d47e4
* feat: add provider-agnostic tool_web_search() and tool_web_fetch()
Add built-in web search and URL fetch tools that work across providers:
- tool_web_search(): Works with OpenAI, Anthropic, and Google
- tool_web_fetch(): Works with Anthropic and Google
Each provider automatically translates the tool configuration to its
specific API format. Supports options like allowed_domains, blocked_domains,
user_location, and max_uses where applicable.
This is equivalent to tidyverse/ellmer#829 but with a cleaner provider-agnostic
API (one function instead of separate functions per provider).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: wrap Google builtin tools in GoogleTool()
GoogleSearch and UrlContext must be passed as keyword arguments
to GoogleTool(), not directly to config.tools.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: add warning helper and use generic examples
- Add _warn_unsupported() helper to reduce warning code duplication
- Update examples to use generic domains (wikipedia.org, python.org)
instead of Posit/Tidyverse-specific ones
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add content types for web search/fetch requests and results
Add ContentWebSearchRequest, ContentWebSearchResults, ContentWebFetchRequest,
and ContentWebFetchResults to represent built-in web tool interactions.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: handle web search/fetch response types in providers
- Anthropic: Handle server_tool_use, web_search_tool_result, and
web_fetch_tool_result content types
- OpenAI: Handle web_search_call output type
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add citation streaming support for Claude
Handle citations_delta chunk type during streaming to accumulate
citations on content blocks.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: document Claude web_fetch beta header requirement
Update tool_web_fetch docstring to explain that Claude requires
the anthropic-beta: web-fetch-2025-09-10 header.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: add changelog entry for web search/fetch tools
Document the new tool_web_search() and tool_web_fetch() functions
and associated content types.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: add web search/fetch to API reference
- Add new "Built-in tools" section with tool_web_search and tool_web_fetch
- Export new content types from chatlas.types module
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: add built-in tools section to tools guide
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: restructure MCP tools guide to prioritize 3rd party servers
- Add Quick start section with MCP Fetch server example
- Add Finding MCP servers section with awesome-mcp-servers link
- Reorder to show Stdio before HTTP (more common for 3rd party)
- Move "Building your own server" section later
- Rename "Motivating example" to "Advanced example: Code execution"
- Add callout linking to built-in tool_web_fetch/tool_web_search alternatives
- Update tools.qmd link to point to quick start section
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use correct uvx command for MCP Fetch server
The MCP Fetch server is run via `uvx mcp-server-fetch`, not npx.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use ChatAnthropic for MCP Fetch examples
OpenAI's function calling API doesn't support the "format": "uri"
JSON Schema format used by the MCP Fetch server. Switch examples
to use ChatAnthropic which has better MCP compatibility.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: strip unsupported JSON Schema format field for MCP tools
OpenAI's function calling API doesn't support JSON Schema format hints
like "uri" or "date-time". Strip these from MCP tool schemas so they
work across all providers.
Also reverts docs to use ChatOpenAI for MCP Fetch examples since the
fix enables cross-provider compatibility.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: ensure all properties in required array for OpenAI compatibility
OpenAI requires all properties to be listed in the required array.
Update sanitize_schema to add all property keys to required.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: properly handle optional params in MCP tool schemas
OpenAI requires all properties in the required array with strict mode.
Optional parameters are indicated using anyOf with null type, matching
how pydantic_function_tool generates schemas.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use strict=False for MCP tools to preserve optional params
MCP tools use standard JSON Schema conventions where optional params
are simply not in the required array. Setting strict=False for OpenAI
allows this to work properly, so the LLM won't be forced to provide
values for all parameters.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Cleanup OpenAI web search content handling
* Better error message
* fix: OpenAI web search content -> message param
* Add web search/fetch integration tests from ellmer PR #829
Port integration tests from tidyverse/ellmer#829:
- Add assert_tool_web_fetch and assert_tool_web_search helpers to conftest.py
- Add test_anthropic_web_fetch and test_anthropic_web_search
- Add test_google_web_fetch and test_google_web_search
- Add test_openai_web_search (OpenAI doesn't support web_fetch)
Fix Anthropic provider to handle web search/fetch content in multi-turn
conversations by explicitly storing only API-input-accepted fields
(the API response includes output-only fields like citations, text, url
that aren't accepted when replaying turns).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Cleanup after Claude
* Rmove top-level imports
* Rename web content types to match ellmer naming convention
- ContentWebSearchRequest → ContentToolRequestSearch
- ContentWebSearchResults → ContentToolResponseSearch
- ContentWebFetchRequest → ContentToolRequestFetch
- ContentWebFetchResults → ContentToolResponseFetch
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Remove MCP compatibility changes (split to separate PR)
The MCP tool compatibility improvements (strict=False, sanitize_schema
with format removal, doc restructure) have been moved to a separate PR
(feat/mcp-tool-compat branch).
This PR now focuses solely on the built-in web search/fetch tools:
- tool_web_search() and tool_web_fetch() functions
- Content types for web search/fetch requests and results
- Provider integration tests
The callout tip about built-in tools is kept in mcp-tools.qmd to help
users discover the simpler alternative to MCP Fetch.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add test to make sure we're capturing citations
* Simplify citations logic
* Fix imports
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f5ebf48 commit a7d47e4
File tree
22 files changed
+2893
-23
lines changed- chatlas
- types
- docs
- get-started
- tests
- _vcr
- test_provider_anthropic
- test_provider_google
- test_provider_openai
22 files changed
+2893
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
54 | 62 | | |
55 | 63 | | |
56 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| 90 | + | |
| 91 | + | |
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
135 | 139 | | |
136 | 140 | | |
137 | 141 | | |
| |||
622 | 626 | | |
623 | 627 | | |
624 | 628 | | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
625 | 726 | | |
626 | 727 | | |
627 | 728 | | |
| |||
631 | 732 | | |
632 | 733 | | |
633 | 734 | | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
634 | 739 | | |
635 | 740 | | |
636 | 741 | | |
| |||
661 | 766 | | |
662 | 767 | | |
663 | 768 | | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
664 | 777 | | |
665 | 778 | | |
666 | 779 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| |||
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| 46 | + | |
42 | 47 | | |
43 | 48 | | |
44 | 49 | | |
| |||
494 | 499 | | |
495 | 500 | | |
496 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
497 | 507 | | |
498 | 508 | | |
499 | 509 | | |
| |||
695 | 705 | | |
696 | 706 | | |
697 | 707 | | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
698 | 719 | | |
699 | 720 | | |
700 | 721 | | |
701 | 722 | | |
702 | 723 | | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
703 | 730 | | |
704 | 731 | | |
705 | 732 | | |
| |||
757 | 784 | | |
758 | 785 | | |
759 | 786 | | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
760 | 857 | | |
761 | 858 | | |
762 | 859 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
295 | 296 | | |
296 | 297 | | |
297 | 298 | | |
298 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
299 | 304 | | |
300 | 305 | | |
301 | 306 | | |
| |||
319 | 324 | | |
320 | 325 | | |
321 | 326 | | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
336 | 351 | | |
337 | 352 | | |
338 | 353 | | |
| |||
0 commit comments