Skip to main content

Extending ToolStorePy

ToolStorePy is deliberately modular. Most extension work maps cleanly onto one file or subsystem.

Common extension points

What you want to changeWhere to look
Add a built-in indexindex/registry.py
Change embedding or reranking modelsorchestrator.py constructor
Change index download logicindex/downloader.py
Adjust repo caching behaviorloader/cache.py
Add or tighten AST security rulesutils/security_scanner.py
Tune the LLM scan system promptutils/llm_scanner.py
Change LLM scan token budgetutils/llm_scanner.py (MAX_REPO_CHARS, MAX_FILE_CHARS)
Change env merge behaviorutils/env_merger.py
Change decorator detectionbuilder/parser.py
Change generated server structurebuilder/mcp_builder.py
Change default host/portorchestrator.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

If you are extending the ecosystem rather than the core codebase, see Publishing a Tool Index.