Magetools
A Portable Grimorium for Agentic Tool Discovery.
Magetools gives autonomous AI agents scalable access to thousands of tools ("Spells") without overwhelming their context window. It uses a Hierarchical Active Discovery pattern to organize tools into collections/directories ("Grimoriums") and files ("Chapters") and functions ("Spells"), allowing agents to discover only what they need, when they need it.
Features
- 100% Test Coverage: Fully verified core logic for maximum reliability.
- Active Discovery Protocol: Agents search for capabilities, not specific function names.
- Safe by Default: Strict Mode requires explicit
manifest.jsonto load any code. - Auto-Summarization: Uses Google Gemini to automatically generate technical summaries for your tool collections (Performance optimized: non-blocking).
- Stale Summary Detection: Automatically detects code changes via folder hashing and triggers re-summarization via CLI.
- Google ADK Integration: Works with Google ADK agents with more framework integrations coming soon.
- Graceful Degradation: Works without API keys using MockProvider (limited functionality).
Installation
Using uv (Recommended):
# Core package (minimal dependencies)
uv add magetools
# Full installation with all features
uv add magetools[full]
Using pip:
pip install magetools[full]
Optional Dependencies
| Extra | Description |
|---|---|
[google] |
Google GenAI provider for embeddings and summaries |
[vectordb] |
ChromaDB for vector storage |
[adk] |
Google ADK integration for agents |
[full] |
All of the above |
Usage
Quick Start
# 1. Create a Grimorium(folder) in the .magetools directory
mkdir -p .magetools/file_ops
# 2. Creates the manifest.json for the provided Grimorium(required for Strict Mode)
uv run -m magetools init .magetools/file_ops
# 3. Scan the Grimorium for spells(functions)
# This creates a grimorium_summary.md file with the technical summary of the spells
# and stores the vector embeddings of the spells in a vector database
uv run -m magetools scan
Add Spells (Tools)
# .magetools/file_ops/files.py (A Grimorium chapter is just a .py file in a Grimorium.)
from magetools import spell
@spell
def list_files(path: str = "."):
"""Lists all files in the given directory."""
import os
return os.listdir(path)
@spell
def read_file(path: str):
"""Reads and returns the contents of a file."""
with open(path, "r") as f:
return f.read()
Use with an Agent
from google.adk.agents import LlmAgent
from magetools import Grimorium
# Initialize (scans .magetools folder and indexes spells)
grimorium = Grimorium()
# Initialize the root agent
root_agent = LlmAgent(
name="magetools_agent",
model="gemini-2.5-flash",
description="Agent that uses magetools to discover and execute spells.",
instruction=f"""You are an advanced AI assistant with access to magetools.
Be helpful, concise, and focus on solving the user's request effectively.
{grimorium.usage_guide}""",
tools=[grimorium],
)
Agent Discovery Flow
A Magetools Grimorium exposes 3 tools to your agent:
discover_grimoriums(query)– Search for a grimorium using a querydiscover_spells(grimorium_id, query)– Search for a spell within a grimoriumexecute_spell(spell_name, arguments)– Run a spell
Example:
User: "Find and read the data.csv file."
Agent:
discover_grimoriums("file reading")→file_opsdiscover_spells("file_ops", "read csv")→read_fileexecute_spell("file_ops.read_file", {"path": "data.csv"})
Strict Mode (Security)
⚠️ Magetools runs in Strict Mode by default.
Grimoriums require a manifest.json file to load any Python code. This prevents accidental execution of arbitrary code.
# Enable a grimorium
uv run -m magetools init .magetools/my_grimorium
manifest.json example:
{
"version": "1.0",
"enabled": true,
"whitelist": ["list_files", "read_file"]
}
To disable Strict Mode (development only):
grimorium = Grimorium(strict_mode=False)
Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
GOOGLE_API_KEY |
– | Required for Google GenAI (can be set in .env file) |
MAGETOOLS_MODEL |
gemini-2.5-flash |
LLM model for technical summaries |
MAGETOOLS_DEBUG |
false |
Enable debug logging |
YAML Configuration
Create magetools.yaml in your project root:
model_name: gemini-2.5-flash
embedding_model: models/text-embedding-004
debug: false
CLI Reference
uv run -m magetools init <directory> # Generate manifest.json for a grimorium
uv run -m magetools scan # Scan spells and build metadata summaries
uv run -m magetools --help # Show all commands and options
Support
- Documentation: Full documentation site
- Issues: GitHub Issues
- Discussions: Open an issue for questions
Roadmap
- Local embedding provider (no API key required)
- LangChain integration example
- Web UI for spell management
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Run tests:
uv run pytest - Submit a pull request
For major changes, open an issue first to discuss.
Authors
- Malcom Godlike - Initial work
License
Project Status
🚀 Active Development – This project is actively maintained and accepting contributions.
Metadata
Release files for magetools 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| magetools-1.3.0.tar.gz | 20.3 kB | With provenance | Details for magetools-1.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| magetools-1.3.0-py3-none-any.whl | Python 3 | none | any | Details for magetools-1.3.0-py3-none-any.whl |
Total release size: 45.5 kB
Release files / magetools-1.3.0.tar.gz
| Download URL | magetools-1.3.0.tar.gz |
|---|---|
| Size | 20.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d2e01f8e6c3d7bbe0c1edceb4c6e30d68cb0444033609b99731d8c4081c8264c
|
|
BLAKE2b-256 checksum How to use checksums |
97104e2817c4ce5c1ed9d77d2f90b459c9b76c6db1eb37dcb1517f9f13cf0ce4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.
Transparency logRelease files / magetools-1.3.0-py3-none-any.whl
| Download URL | magetools-1.3.0-py3-none-any.whl |
|---|---|
| Size | 25.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04c0701eff4725d304278305894878e48a153df8a059212686a6f668e5b5d008
|
|
BLAKE2b-256 checksum How to use checksums |
5e3b3b4626869105bf48fa0df0e4e4ff8f6792a3d73a073962dff2ad534e2243
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.
Transparency logSecurity for magetools 1.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for magetools-1.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.