tools package
Extensible tool-calling framework.
Register tools with the @registry.tool decorator. Each tool is an async
callable that receives keyword arguments and returns a string result.
Example usage:
from tools import ToolRegistry
registry = ToolRegistry()
@registry.tool(
name="get_weather",
description="Get the current weather for a location.",
parameters={
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City and state, e.g. 'San Francisco, CA'",
},
},
"required": ["location"],
},
)
async def get_weather(location: str) -> str:
return f"The weather in {location} is sunny and 72°F."
- class tools.ToolDefinition(name, description, parameters, handler, no_background=False, allow_repeat=False)[source]
Bases:
objectInternal representation of a registered tool.
- Parameters:
- class tools.ToolRegistry(task_manager=None)[source]
Bases:
objectRegistry that stores tool definitions and executes tool calls.
- Parameters:
task_manager (TaskManager | None)
- __init__(task_manager=None)[source]
Initialize the instance.
- Parameters:
task_manager (
TaskManager|None) – The task manager value.- Return type:
None
- task_manager: TaskManager | None
- set_permissions(permissions)[source]
Set per-tool user whitelists.
permissions maps tool names to lists of allowed user IDs. A special value
"*"in the list means everyone. Tools not present in the dict are allowed for all users.
- is_allowed(tool_name, user_id)[source]
Return
Trueif user_id may execute tool_name.Rules: 1. Tool not in the permissions dict -> allow (backward compatible). 2.
"*"in the tool’s allowed list -> allow. 3. user_id in the tool’s allowed list -> allow. 4. Otherwise -> deny.
- async call(name, arguments, user_id='', ctx=None)[source]
Execute a registered tool by name and return the result string.
If user_id is provided, the tool’s permission whitelist is checked first. If ctx is provided and the handler declares a
ctxparameter, the context is injected automatically.If the tool raises an exception the error message is returned so the LLM can see what went wrong and recover.
- invalidate_cache()[source]
Clear the cached OpenAI tool representations.
Called automatically when tools are registered via the
tooldecorator. Must also be called explicitly after bulk mutations such as_tools.clear()(e.g. inreload_tools).- Return type:
- get_openai_tools()[source]
Return tool definitions in the OpenAI function-calling JSON format.
Returns an empty list when no tools are registered, which means the
toolsparameter can be omitted from the API call.
- get_openai_tools_by_names(names)[source]
Return only the OpenAI tool dicts whose names are in names.
Uses a cached
dictfor O(1) per-name lookup instead of rebuilding and filtering the full list each time.
- repeat_allowed_tools()[source]
Return names of tools that are exempt from repetition-loop detection.
Submodules
- tools.adb_tools module
- tools.alter_privileges module
- tools.audio_edit module
- tools.auto_cover module
- tools.await_task module
- tools.aws_tools module
- tools.backup_tools module
- tools.bot_control module
- tools.brave_search module
- tools.btc_wallet_tools module
- tools.certbot_tools module
- tools.channel_summary_tools module
- tools.chat_analytics module
- tools.check_env module
- tools.check_task module
- tools.chromadb_tools module
- tools.cisa_kev_tools module
- tools.cloud_rag module
- tools.cloudflare_dns_tools module
- tools.comfyui_generate_image module
- tools.community_tools module
- tools.compose_gameboard module
- tools.connect_service module
- tools.context_window_tools module
- tools.cross_channel_query module
- tools.current_time module
- tools.cursor_tool module
- tools.data_viz module
- tools.debug_limbic_import module
- tools.debug_limbic_shard module
- tools.deep_think_tool module
- tools.desktop_tools module
- tools.discord_delete_message module
- tools.discord_edit_message module
- tools.discord_embed module
- tools.discord_invite module
- tools.discord_leave_server module
- tools.discord_manage_channels module
- tools.discord_manage_roles module
- tools.discord_message_reactions module
- tools.discord_moderation module
- tools.discord_poll module
- tools.discord_react module
- tools.discord_send_dm module
- tools.discord_server_emojis module
- tools.discord_server_info module
- tools.discord_upload_file module
- tools.discord_user_tools module
- tools.discord_voice_states module
- tools.discord_webhooks module
- tools.dm_history module
- tools.dns_tools module
- tools.docker_code_tool module
- tools.docker_tools module
- tools.donate_embed_key module
- tools.edit_image module
- tools.elevenlabs_music module
- tools.elevenlabs_sfx module
- tools.elevenlabs_tts module
- tools.elevenlabs_voice_design module
- tools.eth_wallet_tools module
- tools.etherpad_tools module
- tools.evm_decompiler module
- tools.exit_game module
- tools.extend_tool_loop module
- tools.file_download module
- tools.file_ops module
- tools.firewall_tools module
- tools.flavor_tool module
- tools.force_guild_index module
- tools.game_asset_upload module
- tools.game_controls module
- tools.gandi_dns_tools module
- tools.gcp_tools module
- tools.gemini_tool module
- tools.generate_image module
- tools.generate_music module
- tools.get_current_guild_count module
- tools.get_server_diagnostics module
- tools.get_user_profile module
- tools.git_repo_tools module
- tools.gitea_tools module
gitea_list_repos()gitea_search_repos()gitea_get_repo()gitea_create_repo()gitea_list_issues()gitea_get_issue()gitea_create_issue()gitea_update_issue()gitea_list_pull_requests()gitea_get_pull_request()gitea_create_pull_request()gitea_merge_pull_request()gitea_get_file()gitea_list_commits()gitea_get_commit()gitea_list_notifications()gitea_star_repo()gitea_list_branches()gitea_create_repo_from_template()
- tools.github_tools module
- tools.goal_tools module
- tools.google_oauth_tools module
- tools.grok_imagine module
- tools.headless_browser module
HeadlessBrowserManagerHeadlessBrowserManager.default_context_idHeadlessBrowserManager.is_initializedHeadlessBrowserManager.last_usedHeadlessBrowserManager.usage_countHeadlessBrowserManager.error_countHeadlessBrowserManager.max_errors_before_restartHeadlessBrowserManager.idle_timeoutHeadlessBrowserManager._lockHeadlessBrowserManager.default_viewportHeadlessBrowserManager.default_user_agentHeadlessBrowserManager.__init__()HeadlessBrowserManager.initialize()HeadlessBrowserManager.ensure_ready()HeadlessBrowserManager.restart()HeadlessBrowserManager.cleanup()HeadlessBrowserManager.get_page()HeadlessBrowserManager.get_context()HeadlessBrowserManager.create_new_context()HeadlessBrowserManager.close_context()HeadlessBrowserManager.record_error()
browser_navigate()browser_go_back()browser_go_forward()browser_reload()browser_close_context()browser_click()browser_type()browser_fill()browser_fill_form()browser_select_option()browser_press_key()browser_hover()browser_scroll()browser_get_content()browser_get_text()browser_get_attribute()browser_get_page_info()browser_query_selector_all()browser_wait_for_selector()browser_wait_for_load_state()browser_wait_for_url()browser_wait()browser_screenshot()browser_pdf()browser_evaluate()browser_execute()browser_get_cookies()browser_set_cookies()browser_clear_cookies()browser_emulate_device()browser_set_geolocation()browser_set_viewport()browser_block_resources()browser_get_status()browser_restart()browser_new_context()browser_enable_response_interception()browser_wait_for_response()browser_get_intercepted_responses()browser_get_response_body()browser_clear_intercepted_responses()browser_create_persistent_context()browser_list_sessions()browser_delete_session()browser_wait_for_download()browser_get_downloads()browser_save_download()browser_get_console_logs()browser_clear_console_logs()browser_handle_dialog()browser_get_pending_dialog()
- tools.hot_swap_game module
- tools.http_poster module
- tools.import_mcp_tool module
- tools.inject_ncm module
- tools.ipmi_tools module
- tools.ipsec_tools module
- tools.kafka_tools module
- tools.knowledge_graph module
- tools.kubernetes_tools module
- tools.lightning_tools module
- tools.list_active_servers module
- tools.list_all_tools module
- tools.loopcast module
- tools.magnet_link_search module
- tools.manage_api_keys module
- tools.manage_secrets module
- tools.masscan_tools module
- tools.microsoft_tools module
- tools.minecraft_rcon_tool module
- tools.modify_self_json module
- tools.monero_tools module
- tools.mongodb_tools module
- tools.music_steering module
- tools.mysql_tools module
- tools.ncm_reset module
- tools.nginx_tools module
- tools.nmap_tools module
- tools.object_storage_tools module
- tools.oci_tools module
- tools.openpgp_tools module
- tools.openvpn_tools module
- tools.pause_music module
- tools.pdf_generator module
- tools.pid_vpn_route_tools module
- tools.ping module
- tools.play_music module
- tools.postgres_tools module
- tools.proactive_controls module
- tools.proactive_relevance_tools module
- tools.proactive_triage_control module
- tools.proxmox_tools module
- tools.qr_generator module
- tools.query_arxiv module
- tools.query_golden_goddess_v2 module
- tools.query_spiral_goddess module
- tools.rabbitmq_tools module
- tools.rag module
- tools.read_own_docs module
- tools.read_service_logs module
- tools.read_tool_code module
- tools.redirect_task module
- tools.redis_tools module
- tools.refine_prompt module
- tools.reload_tools module
- tools.render_mermaid module
- tools.request_tool_injection module
- tools.research_tool module
- tools.reset_music_context module
- tools.resume_music module
- tools.royal_bitch module
- tools.scheduled_prompt module
- tools.security_tools module
- tools.selfbot_relationships module
- tools.selfbot_server module
- tools.selfbot_settings module
- tools.set_sprite module
- tools.sftp_tools module
- tools.shell_tool module
- tools.short_term_notes module
- tools.socket_tools module
- tools.sqlite_tools module
- tools.ssh module
- tools.stl_generator module
- tools.stop_music module
- tools.stream_to_channel module
- tools.subagent_tools module
- tools.suno_music module
- tools.tenor_search module
- tools.terraform_tools module
- tools.threadweave_tools module
- tools.tls_tools module
- tools.tool_vector_search module
- tools.tor_tools module
- tools.tor_transproxy_tools module
- tools.totp_tools module
- tools.traceroute_tools module
- tools.universal_decoder module
- tools.unsandboxed_python_tool module
- tools.user_sandbox_tools module
- tools.user_variables module
- tools.vpn_tools module
- tools.vultr_tools module
- tools.wait_tool module
- tools.web_scraper module
- tools.wipe_game_data module
- tools.write_python_tool module
- tools.youtube_describe module
- tools.youtube_search module