Extending ToolStorePy
ToolStorePy is deliberately modular. Most extension work maps cleanly onto one file or subsystem.
Common extension points
| What you want to change | Where to look |
|---|---|
| Add a built-in index | index/registry.py |
| Change embedding or reranking models | orchestrator.py constructor |
| Change index download logic | index/downloader.py |
| Adjust repo caching behavior | loader/cache.py |
| Add or tighten AST security rules | utils/security_scanner.py |
| Tune the LLM scan system prompt | utils/llm_scanner.py |
| Change LLM scan token budget | utils/llm_scanner.py (MAX_REPO_CHARS, MAX_FILE_CHARS) |
| Change env merge behavior | utils/env_merger.py |
| Change decorator detection | builder/parser.py |
| Change generated server structure | builder/mcp_builder.py |
| Change default host/port | orchestrator.py constructor defaults |
LLM scanner extension
utils/llm_scanner.py uses LangChain's init_chat_model and with_structured_output. To change the verdict schema, update the LLMVerdict and LLMFinding Pydantic models. To tune what the model looks for, edit _SYSTEM_PROMPT.
The scanner is provider-agnostic. Any LangChain-supported model string works.
Adding a built-in index
In index/registry.py, add an entry to BUILTIN_INDEXES:
BUILTIN_INDEXES = {
"core-tools": {
"url": "https://...",
"sha256": "abc123...", # fill in after publishing
},
"my-index": {
"url": "https://example.com/my-index.zip",
"sha256": None,
},
}
The sha256 field enables integrity verification in the downloader. Set it once you have a stable release.
Good extension patterns
- keep retrieval changes separate from build synthesis changes
- preserve auditability in generated outputs
- add evaluation coverage when you change parser or build behavior
- treat security rules as user-facing policy, not only internal code
Related contributor workflow
If you are extending the ecosystem rather than the core codebase, see Publishing a Tool Index.