toolspotter 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. toolspotter-0.1.0/LICENSE +21 -0
  2. toolspotter-0.1.0/MANIFEST.in +6 -0
  3. toolspotter-0.1.0/PKG-INFO +258 -0
  4. toolspotter-0.1.0/README.md +222 -0
  5. toolspotter-0.1.0/eval/SOURCES.md +29 -0
  6. toolspotter-0.1.0/eval/build_catalog.py +94 -0
  7. toolspotter-0.1.0/eval/custom/catalog.json +1235 -0
  8. toolspotter-0.1.0/eval/custom/requests.json +1299 -0
  9. toolspotter-0.1.0/eval/github/LICENSE +21 -0
  10. toolspotter-0.1.0/eval/github/catalog.json +4281 -0
  11. toolspotter-0.1.0/eval/github/requests.json +83 -0
  12. toolspotter-0.1.0/eval/playwright/LICENSE +201 -0
  13. toolspotter-0.1.0/eval/playwright/catalog.json +644 -0
  14. toolspotter-0.1.0/eval/playwright/requests.json +21 -0
  15. toolspotter-0.1.0/eval/run.py +266 -0
  16. toolspotter-0.1.0/pyproject.toml +57 -0
  17. toolspotter-0.1.0/setup.cfg +4 -0
  18. toolspotter-0.1.0/tests/conftest.py +67 -0
  19. toolspotter-0.1.0/tests/data/catalog.json +239 -0
  20. toolspotter-0.1.0/tests/data/mcp_servers/http_shop.py +65 -0
  21. toolspotter-0.1.0/tests/data/mcp_servers/paged.py +33 -0
  22. toolspotter-0.1.0/tests/data/mcp_servers/shop.py +57 -0
  23. toolspotter-0.1.0/tests/test_api.py +96 -0
  24. toolspotter-0.1.0/tests/test_cache_recovery.py +125 -0
  25. toolspotter-0.1.0/tests/test_cli.py +59 -0
  26. toolspotter-0.1.0/tests/test_config.py +92 -0
  27. toolspotter-0.1.0/tests/test_crud.py +187 -0
  28. toolspotter-0.1.0/tests/test_database.py +111 -0
  29. toolspotter-0.1.0/tests/test_derive.py +59 -0
  30. toolspotter-0.1.0/tests/test_embedding_fallback.py +121 -0
  31. toolspotter-0.1.0/tests/test_eval.py +147 -0
  32. toolspotter-0.1.0/tests/test_gemini_chat.py +61 -0
  33. toolspotter-0.1.0/tests/test_guardrail.py +77 -0
  34. toolspotter-0.1.0/tests/test_history.py +405 -0
  35. toolspotter-0.1.0/tests/test_incremental_duplicates.py +123 -0
  36. toolspotter-0.1.0/tests/test_index_db.py +209 -0
  37. toolspotter-0.1.0/tests/test_llm.py +144 -0
  38. toolspotter-0.1.0/tests/test_local_only.py +112 -0
  39. toolspotter-0.1.0/tests/test_mcp.py +43 -0
  40. toolspotter-0.1.0/tests/test_mcp_import.py +251 -0
  41. toolspotter-0.1.0/tests/test_mcp_remote.py +339 -0
  42. toolspotter-0.1.0/tests/test_mutation.py +114 -0
  43. toolspotter-0.1.0/tests/test_persistence.py +547 -0
  44. toolspotter-0.1.0/tests/test_routing.py +150 -0
  45. toolspotter-0.1.0/tests/test_side_effects.py +69 -0
  46. toolspotter-0.1.0/tests/test_split_by_match.py +51 -0
  47. toolspotter-0.1.0/tests/test_validation.py +246 -0
  48. toolspotter-0.1.0/tests/test_versions.py +59 -0
  49. toolspotter-0.1.0/tests/test_website.py +391 -0
  50. toolspotter-0.1.0/tests/test_website_mcp.py +119 -0
  51. toolspotter-0.1.0/toolspotter/__init__.py +13 -0
  52. toolspotter-0.1.0/toolspotter/api.py +437 -0
  53. toolspotter-0.1.0/toolspotter/catalog_changes.py +109 -0
  54. toolspotter-0.1.0/toolspotter/catalog_loader.py +188 -0
  55. toolspotter-0.1.0/toolspotter/cli.py +361 -0
  56. toolspotter-0.1.0/toolspotter/config.py +121 -0
  57. toolspotter-0.1.0/toolspotter/database.py +66 -0
  58. toolspotter-0.1.0/toolspotter/domain/__init__.py +21 -0
  59. toolspotter-0.1.0/toolspotter/domain/errors.py +58 -0
  60. toolspotter-0.1.0/toolspotter/domain/models.py +113 -0
  61. toolspotter-0.1.0/toolspotter/domain/naming.py +69 -0
  62. toolspotter-0.1.0/toolspotter/domain/versioning.py +149 -0
  63. toolspotter-0.1.0/toolspotter/engine/__init__.py +5 -0
  64. toolspotter-0.1.0/toolspotter/engine/bm25.py +62 -0
  65. toolspotter-0.1.0/toolspotter/engine/confidence.py +115 -0
  66. toolspotter-0.1.0/toolspotter/engine/dedup.py +60 -0
  67. toolspotter-0.1.0/toolspotter/engine/derive.py +215 -0
  68. toolspotter-0.1.0/toolspotter/engine/guardrail.py +218 -0
  69. toolspotter-0.1.0/toolspotter/engine/hyde.py +86 -0
  70. toolspotter-0.1.0/toolspotter/engine/ingest.py +88 -0
  71. toolspotter-0.1.0/toolspotter/engine/llm_planner.py +147 -0
  72. toolspotter-0.1.0/toolspotter/engine/pipeline.py +783 -0
  73. toolspotter-0.1.0/toolspotter/engine/planner.py +265 -0
  74. toolspotter-0.1.0/toolspotter/engine/retrieval.py +140 -0
  75. toolspotter-0.1.0/toolspotter/engine/text.py +134 -0
  76. toolspotter-0.1.0/toolspotter/history.py +198 -0
  77. toolspotter-0.1.0/toolspotter/importers/__init__.py +12 -0
  78. toolspotter-0.1.0/toolspotter/importers/common.py +62 -0
  79. toolspotter-0.1.0/toolspotter/importers/mcp_importer.py +308 -0
  80. toolspotter-0.1.0/toolspotter/importers/mcp_remote.py +184 -0
  81. toolspotter-0.1.0/toolspotter/index_db.py +166 -0
  82. toolspotter-0.1.0/toolspotter/limits.py +38 -0
  83. toolspotter-0.1.0/toolspotter/log.py +34 -0
  84. toolspotter-0.1.0/toolspotter/mcp_server.py +93 -0
  85. toolspotter-0.1.0/toolspotter/netutil.py +41 -0
  86. toolspotter-0.1.0/toolspotter/postman.py +95 -0
  87. toolspotter-0.1.0/toolspotter/providers/__init__.py +33 -0
  88. toolspotter-0.1.0/toolspotter/providers/base.py +74 -0
  89. toolspotter-0.1.0/toolspotter/providers/gemini.py +136 -0
  90. toolspotter-0.1.0/toolspotter/providers/local_tfidf.py +74 -0
  91. toolspotter-0.1.0/toolspotter/state.py +131 -0
  92. toolspotter-0.1.0/toolspotter/store.py +95 -0
  93. toolspotter-0.1.0/toolspotter/ui/app.js +513 -0
  94. toolspotter-0.1.0/toolspotter/ui/effects.js +130 -0
  95. toolspotter-0.1.0/toolspotter/ui/favicon.svg +4 -0
  96. toolspotter-0.1.0/toolspotter/ui/index.html +162 -0
  97. toolspotter-0.1.0/toolspotter/ui/mark-dark.svg +3 -0
  98. toolspotter-0.1.0/toolspotter/ui/style.css +296 -0
  99. toolspotter-0.1.0/toolspotter/web.py +232 -0
  100. toolspotter-0.1.0/toolspotter.egg-info/PKG-INFO +258 -0
  101. toolspotter-0.1.0/toolspotter.egg-info/SOURCES.txt +103 -0
  102. toolspotter-0.1.0/toolspotter.egg-info/dependency_links.txt +1 -0
  103. toolspotter-0.1.0/toolspotter.egg-info/entry_points.txt +2 -0
  104. toolspotter-0.1.0/toolspotter.egg-info/requires.txt +16 -0
  105. toolspotter-0.1.0/toolspotter.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Akshraj Chavda
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ # The source package carries what the tests read.
2
+ graft tests
3
+ graft eval
4
+ global-exclude *.py[cod]
5
+ prune **/__pycache__
6
+ prune **/.toolspotter
@@ -0,0 +1,258 @@
1
+ Metadata-Version: 2.4
2
+ Name: toolspotter
3
+ Version: 0.1.0
4
+ Summary: Intelligent tool router: filters a large enterprise tool catalog down to a small, high-precision, ordered tool plan per query (routing-as-a-service).
5
+ Author: Akshraj Chavda
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/akshraj-05/toolspotter
8
+ Project-URL: Documentation, https://github.com/akshraj-05/toolspotter/blob/main/docs/usage.md
9
+ Project-URL: Issues, https://github.com/akshraj-05/toolspotter/issues
10
+ Keywords: ai-agents,llm,mcp,tool-routing,tool-selection,function-calling
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: pydantic>=2.5
24
+ Requires-Dist: platformdirs>=4.0
25
+ Requires-Dist: fastapi>=0.110
26
+ Requires-Dist: uvicorn>=0.29
27
+ Requires-Dist: mcp<2,>=1.30
28
+ Provides-Extra: api
29
+ Provides-Extra: mcp
30
+ Provides-Extra: test
31
+ Requires-Dist: pytest>=8; extra == "test"
32
+ Requires-Dist: httpx>=0.27; extra == "test"
33
+ Provides-Extra: keyring
34
+ Requires-Dist: keyring>=24; extra == "keyring"
35
+ Dynamic: license-file
36
+
37
+ <div align="center">
38
+
39
+ <picture>
40
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/akshraj-05/toolspotter/main/brand/logo-dark.svg">
41
+ <img src="https://raw.githubusercontent.com/akshraj-05/toolspotter/main/brand/logo.svg" alt="ToolSpotter" width="330">
42
+ </picture>
43
+
44
+ **Find the right tools for an AI agent without sending the entire tool catalog into every prompt.**
45
+
46
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-5b5bf0)](https://github.com/akshraj-05/toolspotter/blob/main/pyproject.toml)
47
+ [![License: MIT](https://img.shields.io/badge/license-MIT-5b5bf0)](https://github.com/akshraj-05/toolspotter/blob/main/LICENSE)
48
+ [![REST API](https://img.shields.io/badge/API-FastAPI-5b5bf0)](https://github.com/akshraj-05/toolspotter/blob/main/docs/usage.md#manage-tools-over-rest)
49
+ [![MCP server](https://img.shields.io/badge/MCP-server-5b5bf0)](#use-it-from-an-agent)
50
+
51
+ <a href="#quick-start">Quick start</a> ·
52
+ <a href="#adding-tools">Adding tools</a> ·
53
+ <a href="#use-it-from-an-agent">Agents</a> ·
54
+ <a href="#evaluation">Evaluation</a> ·
55
+ <a href="#documentation">Documentation</a>
56
+
57
+ </div>
58
+
59
+ <img src="https://raw.githubusercontent.com/akshraj-05/toolspotter/main/docs/images/dashboard.png" alt="The ToolSpotter dashboard: tool counts, charts by group and side effect, and request statistics">
60
+
61
+ ## Why ToolSpotter
62
+
63
+ An agent with many tools has to read every definition before it can act, which costs tokens and makes similar tools easy to confuse. ToolSpotter takes a request in plain language and returns a **short, ordered list of tools** for the agent to use. It selects tools; it does **not** run them.
64
+
65
+ ## Features
66
+
67
+ | | |
68
+ |---|---|
69
+ | **Works without an API key** | Local keyword and vector search with rule-based planning |
70
+ | **Optional LLM planner** | Gemini, with the local planner as the fallback |
71
+ | **Careful by default** | Asks before unclear or destructive requests; returns nothing when no tool fits |
72
+ | **Easy to load** | JSON catalog, upload with preview, or a scan of a local or remote MCP server |
73
+ | **Three interfaces** | Website, REST API and read-only MCP server |
74
+ | **Small to run** | One Python process and one SQLite file |
75
+
76
+ ## Quick start
77
+
78
+ You need Python 3.11 or newer.
79
+
80
+ ```bash
81
+ python3 -m venv .venv && source .venv/bin/activate
82
+ pip install toolspotter
83
+ toolspotter serve # starts empty: add tools on the website
84
+ ```
85
+
86
+ Then open the website at http://127.0.0.1:8080/ui/ or the API documentation at http://127.0.0.1:8080/docs (the latter needs an internet connection).
87
+
88
+ With Docker, no Python needed:
89
+
90
+ ```bash
91
+ docker run -p 127.0.0.1:8080:8080 akshraj05/toolspotter # starts empty: add tools on the website
92
+ ```
93
+
94
+ To run from source, with a sample catalog:
95
+
96
+ ```bash
97
+ git clone https://github.com/akshraj-05/toolspotter.git
98
+ cd toolspotter
99
+ python3 -m venv .venv && source .venv/bin/activate
100
+ pip install -e .
101
+ toolspotter serve --catalog tests/data/catalog.json
102
+ ```
103
+
104
+ To build the Docker image yourself, run `docker build -t toolspotter .` in the cloned folder.
105
+
106
+ ### Ask for tools
107
+
108
+ ```bash
109
+ curl -s -X POST http://127.0.0.1:8080/route \
110
+ -H 'content-type: application/json' \
111
+ -d '{"query": "Get the logs and then open an incident"}'
112
+ ```
113
+
114
+ With the larger catalog in `eval/custom/catalog.json` (in the repository), the answer includes (shortened):
115
+
116
+ ```json
117
+ {
118
+ "selected_tools": ["ops.get_logs", "ops.create_incident"],
119
+ "plan": ["ops.get_logs", "ops.create_incident"],
120
+ "clarify": false,
121
+ "clarify_question": null,
122
+ "tokens_saved_pct": 0.9677
123
+ }
124
+ ```
125
+
126
+ The full response also holds the selected tool definitions and a trace of the scores. `tokens_saved_pct` is an estimate of the tool-definition tokens saved.
127
+
128
+ <img src="https://raw.githubusercontent.com/akshraj-05/toolspotter/main/docs/images/try-it.png" alt="The Try it page: two planned steps and the scores of the best matching tools">
129
+
130
+ ## Adding tools
131
+
132
+ Add tools on the website, from a file, from an MCP server or over REST. Every route applies the same checks.
133
+
134
+ ### Upload a catalog file
135
+
136
+ Choose a file under **Add tools**. The preview shows what is new, changed or rejected, and why, before anything is saved.
137
+
138
+ <img src="https://raw.githubusercontent.com/akshraj-05/toolspotter/main/docs/images/add-upload.png" alt="Upload preview listing new tools and one rejected tool with the reason">
139
+
140
+ ```json
141
+ {
142
+ "tools": [
143
+ {
144
+ "name": "send_email",
145
+ "description": "Send an email message to a recipient with a subject and body",
146
+ "parameters": [{"name": "to", "type": "string", "required": true}],
147
+ "side_effects": "write"
148
+ }
149
+ ]
150
+ }
151
+ ```
152
+
153
+ `name`, `description` (at least 6 words) and `parameters` are required. Set `side_effects` to `read`, `write` or `destructive` for any tool that changes data. See the [tool format and limits](https://github.com/akshraj-05/toolspotter/blob/main/docs/usage.md#tool-format).
154
+
155
+ From the command line:
156
+
157
+ ```bash
158
+ toolspotter validate catalog.json # check a file first
159
+ toolspotter serve --catalog catalog.json
160
+ ```
161
+
162
+ ### Scan an MCP server
163
+
164
+ Enter the server's URL and a token if it needs one, then pick the tools to add. The token is used once and never saved.
165
+
166
+ <img src="https://raw.githubusercontent.com/akshraj-05/toolspotter/main/docs/images/add-mcp.png" alt="Result of scanning an MCP server, with a checkbox for each tool">
167
+
168
+ A local MCP server is loaded from the command line:
169
+
170
+ ```bash
171
+ toolspotter serve --import-mcp "python my_server.py"
172
+ ```
173
+
174
+ ### Create or edit one tool
175
+
176
+ Press **New tool**, or select any tool in the list to change or delete it.
177
+
178
+ <img src="https://raw.githubusercontent.com/akshraj-05/toolspotter/main/docs/images/add-editor.png" alt="Editor with a tool definition as JSON">
179
+
180
+ The same actions are available over [REST](https://github.com/akshraj-05/toolspotter/blob/main/docs/usage.md#manage-tools-over-rest).
181
+
182
+ ## Use it from an agent
183
+
184
+ Call `POST /route` before your model call, or add ToolSpotter to an MCP host. It offers `find_tools` and `registry_status`, and cannot change your tools.
185
+
186
+ ```json
187
+ {
188
+ "mcpServers": {
189
+ "toolspotter": {
190
+ "command": "toolspotter",
191
+ "args": ["mcp", "--catalog", "/path/to/catalog.json"]
192
+ }
193
+ }
194
+ }
195
+ ```
196
+
197
+ ## Configuration
198
+
199
+ ToolSpotter works without any setup. To use the Gemini planner, you need an API key and, optionally, a model:
200
+
201
+ | Setting | Variable | Default |
202
+ |---|---|---|
203
+ | API key | `GEMINI_API_KEY` | |
204
+ | Model | `TOOLSPOTTER_LLM_MODEL` | `gemini-3.5-flash-lite` |
205
+
206
+ Run `toolspotter init` and enter both, or set them in your shell and switch Gemini on:
207
+
208
+ ```bash
209
+ export GEMINI_API_KEY=your-key
210
+ export TOOLSPOTTER_LLM_MODEL=gemini-3.5-flash-lite
211
+ export TOOLSPOTTER_LLM_PROVIDER=gemini
212
+ ```
213
+
214
+ ## Evaluation
215
+
216
+ 110 held-out requests across GitHub MCP tools, Playwright MCP tools and a custom catalog. A request passes only if the answer is exactly right: the expected tools in order, a clarifying question, or nothing.
217
+
218
+ | Setup | `github` (40) | `playwright` (10) | `custom` (60) | All (110) |
219
+ |---|---:|---:|---:|---:|
220
+ | Keyword search baseline | 18 (45%) | 6 (60%) | 20 (33%) | 44 (40%) |
221
+ | Local mode (no LLM, no key) | 25 (62%) | 8 (80%) | 39 (65%) | **72 (65%)** |
222
+ | Gemini planner | 37 (92%) | 10 (100%) | 57 (95%) | **104 (95%)** |
223
+
224
+ Read these with care:
225
+
226
+ - The requests were **written with an AI assistant and not independently reviewed**, which may favour the Gemini score.
227
+ - On requests that need one tool, local mode is **not clearly better than keyword search**. Its gains are in asking questions, rejecting unrelated requests and planning several steps.
228
+ - The Gemini run used `gemini-3.5-flash-lite` on 2026-11-28: 125 calls, none failed.
229
+
230
+ [Full results, limits and how to run it](https://github.com/akshraj-05/toolspotter/blob/main/docs/evaluation.md)
231
+
232
+ ## Documentation
233
+
234
+ | Document | Contents |
235
+ |---|---|
236
+ | [Using ToolSpotter](https://github.com/akshraj-05/toolspotter/blob/main/docs/usage.md) | Website, MCP servers, tool format, REST API, Docker, saved data |
237
+ | [Evaluation](https://github.com/akshraj-05/toolspotter/blob/main/docs/evaluation.md) | Results in detail |
238
+ | [Architecture](https://github.com/akshraj-05/toolspotter/blob/main/docs/design/architecture.md) | How the parts fit together |
239
+ | [Engine design](https://github.com/akshraj-05/toolspotter/blob/main/docs/design/engine-design.md) | The rules in each routing step |
240
+ | [Integrations](https://github.com/akshraj-05/toolspotter/blob/main/docs/design/integrations.md) | Calling it from an agent |
241
+
242
+ ## Contributing
243
+
244
+ Issues and pull requests are welcome.
245
+
246
+ ```bash
247
+ pip install -e ".[test]"
248
+ pytest # runs offline
249
+ python eval/run.py # tuning half, with failures listed
250
+ ```
251
+
252
+ Add tests with your change. Improve routing with general rules, check them on the tuning half, and do not tune against the final half.
253
+
254
+ ## License
255
+
256
+ [MIT](https://github.com/akshraj-05/toolspotter/blob/main/LICENSE) © 2026 Akshraj Chavda.
257
+
258
+ The GitHub and Playwright tool definitions in `eval/` belong to their authors and keep their own licences: see [sources](https://github.com/akshraj-05/toolspotter/blob/main/eval/SOURCES.md).
@@ -0,0 +1,222 @@
1
+ <div align="center">
2
+
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/akshraj-05/toolspotter/main/brand/logo-dark.svg">
5
+ <img src="https://raw.githubusercontent.com/akshraj-05/toolspotter/main/brand/logo.svg" alt="ToolSpotter" width="330">
6
+ </picture>
7
+
8
+ **Find the right tools for an AI agent without sending the entire tool catalog into every prompt.**
9
+
10
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-5b5bf0)](https://github.com/akshraj-05/toolspotter/blob/main/pyproject.toml)
11
+ [![License: MIT](https://img.shields.io/badge/license-MIT-5b5bf0)](https://github.com/akshraj-05/toolspotter/blob/main/LICENSE)
12
+ [![REST API](https://img.shields.io/badge/API-FastAPI-5b5bf0)](https://github.com/akshraj-05/toolspotter/blob/main/docs/usage.md#manage-tools-over-rest)
13
+ [![MCP server](https://img.shields.io/badge/MCP-server-5b5bf0)](#use-it-from-an-agent)
14
+
15
+ <a href="#quick-start">Quick start</a> ·
16
+ <a href="#adding-tools">Adding tools</a> ·
17
+ <a href="#use-it-from-an-agent">Agents</a> ·
18
+ <a href="#evaluation">Evaluation</a> ·
19
+ <a href="#documentation">Documentation</a>
20
+
21
+ </div>
22
+
23
+ <img src="https://raw.githubusercontent.com/akshraj-05/toolspotter/main/docs/images/dashboard.png" alt="The ToolSpotter dashboard: tool counts, charts by group and side effect, and request statistics">
24
+
25
+ ## Why ToolSpotter
26
+
27
+ An agent with many tools has to read every definition before it can act, which costs tokens and makes similar tools easy to confuse. ToolSpotter takes a request in plain language and returns a **short, ordered list of tools** for the agent to use. It selects tools; it does **not** run them.
28
+
29
+ ## Features
30
+
31
+ | | |
32
+ |---|---|
33
+ | **Works without an API key** | Local keyword and vector search with rule-based planning |
34
+ | **Optional LLM planner** | Gemini, with the local planner as the fallback |
35
+ | **Careful by default** | Asks before unclear or destructive requests; returns nothing when no tool fits |
36
+ | **Easy to load** | JSON catalog, upload with preview, or a scan of a local or remote MCP server |
37
+ | **Three interfaces** | Website, REST API and read-only MCP server |
38
+ | **Small to run** | One Python process and one SQLite file |
39
+
40
+ ## Quick start
41
+
42
+ You need Python 3.11 or newer.
43
+
44
+ ```bash
45
+ python3 -m venv .venv && source .venv/bin/activate
46
+ pip install toolspotter
47
+ toolspotter serve # starts empty: add tools on the website
48
+ ```
49
+
50
+ Then open the website at http://127.0.0.1:8080/ui/ or the API documentation at http://127.0.0.1:8080/docs (the latter needs an internet connection).
51
+
52
+ With Docker, no Python needed:
53
+
54
+ ```bash
55
+ docker run -p 127.0.0.1:8080:8080 akshraj05/toolspotter # starts empty: add tools on the website
56
+ ```
57
+
58
+ To run from source, with a sample catalog:
59
+
60
+ ```bash
61
+ git clone https://github.com/akshraj-05/toolspotter.git
62
+ cd toolspotter
63
+ python3 -m venv .venv && source .venv/bin/activate
64
+ pip install -e .
65
+ toolspotter serve --catalog tests/data/catalog.json
66
+ ```
67
+
68
+ To build the Docker image yourself, run `docker build -t toolspotter .` in the cloned folder.
69
+
70
+ ### Ask for tools
71
+
72
+ ```bash
73
+ curl -s -X POST http://127.0.0.1:8080/route \
74
+ -H 'content-type: application/json' \
75
+ -d '{"query": "Get the logs and then open an incident"}'
76
+ ```
77
+
78
+ With the larger catalog in `eval/custom/catalog.json` (in the repository), the answer includes (shortened):
79
+
80
+ ```json
81
+ {
82
+ "selected_tools": ["ops.get_logs", "ops.create_incident"],
83
+ "plan": ["ops.get_logs", "ops.create_incident"],
84
+ "clarify": false,
85
+ "clarify_question": null,
86
+ "tokens_saved_pct": 0.9677
87
+ }
88
+ ```
89
+
90
+ The full response also holds the selected tool definitions and a trace of the scores. `tokens_saved_pct` is an estimate of the tool-definition tokens saved.
91
+
92
+ <img src="https://raw.githubusercontent.com/akshraj-05/toolspotter/main/docs/images/try-it.png" alt="The Try it page: two planned steps and the scores of the best matching tools">
93
+
94
+ ## Adding tools
95
+
96
+ Add tools on the website, from a file, from an MCP server or over REST. Every route applies the same checks.
97
+
98
+ ### Upload a catalog file
99
+
100
+ Choose a file under **Add tools**. The preview shows what is new, changed or rejected, and why, before anything is saved.
101
+
102
+ <img src="https://raw.githubusercontent.com/akshraj-05/toolspotter/main/docs/images/add-upload.png" alt="Upload preview listing new tools and one rejected tool with the reason">
103
+
104
+ ```json
105
+ {
106
+ "tools": [
107
+ {
108
+ "name": "send_email",
109
+ "description": "Send an email message to a recipient with a subject and body",
110
+ "parameters": [{"name": "to", "type": "string", "required": true}],
111
+ "side_effects": "write"
112
+ }
113
+ ]
114
+ }
115
+ ```
116
+
117
+ `name`, `description` (at least 6 words) and `parameters` are required. Set `side_effects` to `read`, `write` or `destructive` for any tool that changes data. See the [tool format and limits](https://github.com/akshraj-05/toolspotter/blob/main/docs/usage.md#tool-format).
118
+
119
+ From the command line:
120
+
121
+ ```bash
122
+ toolspotter validate catalog.json # check a file first
123
+ toolspotter serve --catalog catalog.json
124
+ ```
125
+
126
+ ### Scan an MCP server
127
+
128
+ Enter the server's URL and a token if it needs one, then pick the tools to add. The token is used once and never saved.
129
+
130
+ <img src="https://raw.githubusercontent.com/akshraj-05/toolspotter/main/docs/images/add-mcp.png" alt="Result of scanning an MCP server, with a checkbox for each tool">
131
+
132
+ A local MCP server is loaded from the command line:
133
+
134
+ ```bash
135
+ toolspotter serve --import-mcp "python my_server.py"
136
+ ```
137
+
138
+ ### Create or edit one tool
139
+
140
+ Press **New tool**, or select any tool in the list to change or delete it.
141
+
142
+ <img src="https://raw.githubusercontent.com/akshraj-05/toolspotter/main/docs/images/add-editor.png" alt="Editor with a tool definition as JSON">
143
+
144
+ The same actions are available over [REST](https://github.com/akshraj-05/toolspotter/blob/main/docs/usage.md#manage-tools-over-rest).
145
+
146
+ ## Use it from an agent
147
+
148
+ Call `POST /route` before your model call, or add ToolSpotter to an MCP host. It offers `find_tools` and `registry_status`, and cannot change your tools.
149
+
150
+ ```json
151
+ {
152
+ "mcpServers": {
153
+ "toolspotter": {
154
+ "command": "toolspotter",
155
+ "args": ["mcp", "--catalog", "/path/to/catalog.json"]
156
+ }
157
+ }
158
+ }
159
+ ```
160
+
161
+ ## Configuration
162
+
163
+ ToolSpotter works without any setup. To use the Gemini planner, you need an API key and, optionally, a model:
164
+
165
+ | Setting | Variable | Default |
166
+ |---|---|---|
167
+ | API key | `GEMINI_API_KEY` | |
168
+ | Model | `TOOLSPOTTER_LLM_MODEL` | `gemini-3.5-flash-lite` |
169
+
170
+ Run `toolspotter init` and enter both, or set them in your shell and switch Gemini on:
171
+
172
+ ```bash
173
+ export GEMINI_API_KEY=your-key
174
+ export TOOLSPOTTER_LLM_MODEL=gemini-3.5-flash-lite
175
+ export TOOLSPOTTER_LLM_PROVIDER=gemini
176
+ ```
177
+
178
+ ## Evaluation
179
+
180
+ 110 held-out requests across GitHub MCP tools, Playwright MCP tools and a custom catalog. A request passes only if the answer is exactly right: the expected tools in order, a clarifying question, or nothing.
181
+
182
+ | Setup | `github` (40) | `playwright` (10) | `custom` (60) | All (110) |
183
+ |---|---:|---:|---:|---:|
184
+ | Keyword search baseline | 18 (45%) | 6 (60%) | 20 (33%) | 44 (40%) |
185
+ | Local mode (no LLM, no key) | 25 (62%) | 8 (80%) | 39 (65%) | **72 (65%)** |
186
+ | Gemini planner | 37 (92%) | 10 (100%) | 57 (95%) | **104 (95%)** |
187
+
188
+ Read these with care:
189
+
190
+ - The requests were **written with an AI assistant and not independently reviewed**, which may favour the Gemini score.
191
+ - On requests that need one tool, local mode is **not clearly better than keyword search**. Its gains are in asking questions, rejecting unrelated requests and planning several steps.
192
+ - The Gemini run used `gemini-3.5-flash-lite` on 2026-11-28: 125 calls, none failed.
193
+
194
+ [Full results, limits and how to run it](https://github.com/akshraj-05/toolspotter/blob/main/docs/evaluation.md)
195
+
196
+ ## Documentation
197
+
198
+ | Document | Contents |
199
+ |---|---|
200
+ | [Using ToolSpotter](https://github.com/akshraj-05/toolspotter/blob/main/docs/usage.md) | Website, MCP servers, tool format, REST API, Docker, saved data |
201
+ | [Evaluation](https://github.com/akshraj-05/toolspotter/blob/main/docs/evaluation.md) | Results in detail |
202
+ | [Architecture](https://github.com/akshraj-05/toolspotter/blob/main/docs/design/architecture.md) | How the parts fit together |
203
+ | [Engine design](https://github.com/akshraj-05/toolspotter/blob/main/docs/design/engine-design.md) | The rules in each routing step |
204
+ | [Integrations](https://github.com/akshraj-05/toolspotter/blob/main/docs/design/integrations.md) | Calling it from an agent |
205
+
206
+ ## Contributing
207
+
208
+ Issues and pull requests are welcome.
209
+
210
+ ```bash
211
+ pip install -e ".[test]"
212
+ pytest # runs offline
213
+ python eval/run.py # tuning half, with failures listed
214
+ ```
215
+
216
+ Add tests with your change. Improve routing with general rules, check them on the tuning half, and do not tune against the final half.
217
+
218
+ ## License
219
+
220
+ [MIT](https://github.com/akshraj-05/toolspotter/blob/main/LICENSE) © 2026 Akshraj Chavda.
221
+
222
+ The GitHub and Playwright tool definitions in `eval/` belong to their authors and keep their own licences: see [sources](https://github.com/akshraj-05/toolspotter/blob/main/eval/SOURCES.md).
@@ -0,0 +1,29 @@
1
+ # Test sets
2
+
3
+ | Folder | Tools | Requests | Origin |
4
+ |---|---:|---:|---|
5
+ | [`github/`](github/) | 84 | 81 | GitHub MCP server |
6
+ | [`playwright/`](playwright/) | 17 | 19 | Playwright MCP server |
7
+ | [`custom/`](custom/) | 63 | 120 | Written for this repository |
8
+
9
+ All requests were written for this repository.
10
+
11
+ ## GitHub and Playwright tool definitions
12
+
13
+ These catalogs hold tool definitions written by other people. They are generated by
14
+ `build_catalog.py`; nothing in them was edited by hand.
15
+
16
+ | Folder | Project | Commit | Licence | Tools included |
17
+ |---|---|---|---|---|
18
+ | `github/` | [github/github-mcp-server](https://github.com/github/github-mcp-server) | `7edc2dd` | MIT, © GitHub ([text](github/LICENSE)) | Listed in its README |
19
+ | `playwright/` | [microsoft/playwright-mcp](https://github.com/microsoft/playwright-mcp) | `2337aff` | Apache-2.0, © Microsoft ([text](playwright/LICENSE)) | Core automation and tab management |
20
+
21
+ **Changes made to the originals:** converted to the router's tool format by its MCP
22
+ importer (names, parameter types, long descriptions shortened, side effects labelled), and
23
+ tools the router's validation rejects were left out (GitHub: 12 of 96; Playwright: 8 of 25,
24
+ mostly descriptions under six words, some with more than 12 parameters). Neither server was
25
+ run. Neither project is affiliated with this repository or endorses it.
26
+
27
+ ```bash
28
+ python eval/build_catalog.py PATH/github-mcp-server PATH/playwright-mcp
29
+ ```
@@ -0,0 +1,94 @@
1
+ """Rebuild the GitHub and Playwright catalogs from the source projects (see SOURCES.md).
2
+
3
+ python eval/build_catalog.py PATH/github-mcp-server PATH/playwright-mcp
4
+
5
+ Which tools: every tool listed in the GitHub server's README, and Playwright's
6
+ default groups (core automation and tab management). Definitions are converted by
7
+ the router's own MCP importer and pass its guardrail; nothing is edited by hand.
8
+ Only files are read; neither server is run.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import json
14
+ import re
15
+ import sys
16
+ from pathlib import Path
17
+ from types import SimpleNamespace
18
+
19
+ HERE = Path(__file__).resolve().parent
20
+ sys.path.insert(0, str(HERE.parent))
21
+
22
+ from toolspotter.catalog_loader import split_valid # noqa: E402
23
+ from toolspotter.importers.mcp_importer import _convert # noqa: E402
24
+
25
+ DEFAULT_GROUPS = ("Core automation", "Tab management")
26
+
27
+
28
+ def _tool(name: str, description: str, schema: dict, hints: dict) -> SimpleNamespace:
29
+ annotations = SimpleNamespace(
30
+ readOnlyHint=hints.get("readOnlyHint"), destructiveHint=hints.get("destructiveHint")
31
+ )
32
+ return SimpleNamespace(
33
+ name=name, description=description, inputSchema=schema, annotations=annotations
34
+ )
35
+
36
+
37
+ def github_tools(root: Path) -> list[SimpleNamespace]:
38
+ readme = (root / "README.md").read_text(encoding="utf-8")
39
+ listed = readme.split("START AUTOMATED TOOLS -->")[1].split("END AUTOMATED TOOLS")[0]
40
+ names = dict.fromkeys(re.findall(r"^- \*\*([a-z0-9_]+)\*\*", listed, re.M))
41
+ tools = []
42
+ for name in names:
43
+ path = root / "pkg" / "github" / "__toolsnaps__" / f"{name}.snap"
44
+ if not path.exists():
45
+ print(f"no definition for {name}", file=sys.stderr)
46
+ continue
47
+ raw = json.loads(path.read_text(encoding="utf-8"))
48
+ tools.append(_tool(raw["name"], raw.get("description", ""),
49
+ raw.get("inputSchema") or {}, raw.get("annotations") or {}))
50
+ return tools
51
+
52
+
53
+ def playwright_tools(root: Path) -> list[SimpleNamespace]:
54
+ readme = (root / "README.md").read_text(encoding="utf-8")
55
+ tools = []
56
+ for section in readme.split("<summary><b>")[1:]:
57
+ if section.split("</b>")[0] not in DEFAULT_GROUPS:
58
+ continue
59
+ body = section.split("</details>")[0]
60
+ for block in re.split(r"^- \*\*(?=browser_)", body, flags=re.M)[1:]:
61
+ name = block.split("**")[0]
62
+ description = re.search(r"^ - Description: (.*)$", block, re.M).group(1)
63
+ read_only = re.search(r"Read-only: \*\*(true|false)\*\*", block).group(1) == "true"
64
+ properties, required = {}, []
65
+ for param, kind, optional, text in re.findall(
66
+ r"^ - `(\w+)` \((\w+)(, optional)?\): (.*)$", block, re.M
67
+ ):
68
+ properties[param] = {"type": kind, "description": text.strip()}
69
+ if not optional:
70
+ required.append(param)
71
+ tools.append(_tool(name, description,
72
+ {"properties": properties, "required": required},
73
+ {"readOnlyHint": read_only}))
74
+ return tools
75
+
76
+
77
+ def main(github: str, playwright: str) -> None:
78
+ for folder, prefix, tools in (("github", "github", github_tools(Path(github))),
79
+ ("playwright", "browser", playwright_tools(Path(playwright)))):
80
+ used: set[str] = set()
81
+ converted = [_convert(t, prefix, used) for t in tools]
82
+ accepted, rejected = split_valid(converted)
83
+ print(f"{folder}: {len(accepted)} of {len(converted)} tools accepted")
84
+ for message in rejected:
85
+ print(" skipped", message)
86
+ (HERE / folder / "catalog.json").write_text(
87
+ json.dumps({"tools": accepted}, indent=1, ensure_ascii=False) + "\n", encoding="utf-8"
88
+ )
89
+
90
+
91
+ if __name__ == "__main__":
92
+ if len(sys.argv) != 3:
93
+ raise SystemExit(__doc__)
94
+ main(*sys.argv[1:])