xml-pipeline/agentserver/tools/__init__.py
dullfig 986db2e79b Implement native tools and infrastructure
Tools (18 total):
- calculate: Safe AST-based math expression evaluator
- fetch: Async HTTP with SSRF protection
- files: Sandboxed read/write/list/delete
- shell: Command execution with blocklist
- search: Web search (SerpAPI, Google, Bing)
- keyvalue: In-memory key-value store
- librarian: exist-db XML database integration
- convert: XML↔JSON conversion + XPath extraction

Infrastructure:
- CLI with run/init/check/version commands
- Config loader for organism.yaml
- Feature detection for optional dependencies
- Optional extras in pyproject.toml

LLM:
- Fixed llm_connection.py to wrap working router

WASM:
- Documented WASM listener interface
- Stub implementation for future work

MCP:
- Reddit sentiment MCP server example

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:25:48 -08:00

50 lines
1.3 KiB
Python

"""
Native tools for agents.
Tools are sandboxed, permission-controlled functions that agents can invoke
to interact with the outside world.
"""
from .base import Tool, ToolResult, tool, get_tool_registry
from .calculate import calculate
from .fetch import fetch_url
from .files import read_file, write_file, list_dir, delete_file, configure_allowed_paths
from .shell import run_command, configure_allowed_commands, configure_blocked_commands
from .search import web_search, configure_search
from .keyvalue import key_value_get, key_value_set, key_value_delete
from .librarian import librarian_store, librarian_get, librarian_query, librarian_search, configure_librarian
from .convert import xml_to_json, json_to_xml, xml_extract
__all__ = [
# Base
"Tool",
"ToolResult",
"tool",
"get_tool_registry",
# Configuration
"configure_allowed_paths",
"configure_allowed_commands",
"configure_blocked_commands",
"configure_search",
"configure_librarian",
# Tools
"calculate",
"fetch_url",
"read_file",
"write_file",
"list_dir",
"delete_file",
"run_command",
"web_search",
"key_value_get",
"key_value_set",
"key_value_delete",
"librarian_store",
"librarian_get",
"librarian_query",
"librarian_search",
# Conversion
"xml_to_json",
"json_to_xml",
"xml_extract",
]