Wikipedia

This commit is contained in:
2026-07-24 22:24:23 -07:00
parent b6a820aa21
commit 50c06cc134
3 changed files with 170 additions and 0 deletions
+21
View File
@@ -22,6 +22,7 @@ from .contact_sheet import handle as contact_sheet_handler
from .list_directory import handle as list_directory_details_handler
from .preview_image import handle as preview_image_handler
from .get_text_context import handle as get_text_context_handler
from .wikipedia import handle as wikipedia_handler
# Central registry of all available tools
TOOL_REGISTRY = [
@@ -103,4 +104,24 @@ TOOL_REGISTRY = [
},
handler=get_text_context_handler
),
Tool(
name="browse_wikipedia",
description="Browse Wikipedia pages to retrieve information. Defaults to the page summary. Can also retrieve the table of contents or a specific section. If a page is not found, it automatically returns search results.",
schema={
"type": "object",
"properties": {
"title": {"type": "string", "description": "The title of the Wikipedia page to browse or the search query."},
"mode": {
"type": "string",
"description": "The retrieval mode. 'summary' (default) for the lead section, 'toc' for the table of contents, 'section' for a specific section, or 'search' for explicit search results.",
"enum": ["summary", "toc", "section", "search"],
"default": "summary"
},
"section_index": {"type": "integer", "description": "The linear index of the section to retrieve. Required if mode='section'. This index can be found by calling the tool in 'toc' mode."},
"search_limit": {"type": "integer", "description": "The maximum number of search results to return. Default is 5.", "default": 5},
},
"required": ["title"],
},
handler=wikipedia_handler
),
]