You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
📝 docs(README): update transport methods and tool registry
- clarify support for multiple MCP transport methods in both README_en.md and README_zh.md
- add examples for MCP transport configuration including StreamableHttpTransport and FastMCP
- enhance OpenAPI integration section with auto-discovery explanation and better examples
- refine descriptions of hub tools with expanded functionality details
- introduce community contribution section in both README files
transport = FastMCP(name="MyFastMCP") # FastMCP instance
111
+
transport = StreamableHttpTransport(url="https://mcphub.example.com/mcp", headers={"Authorization": "Bearer token"}) # Transport instance with custom headers
97
112
98
113
registry.register_from_mcp(transport)
99
114
100
-
# Get all tools JSON including MCP tools
115
+
# Get all tools' JSON, including MCP tools
101
116
tools_json = registry.get_tools_json()
102
117
```
103
118
104
-
Supported transport types:
105
-
106
-
- URL string (http://, https://, ws://, wss://)
107
-
- Path to script file (.py, .js)
108
-
- Existing ClientTransport instance
109
-
- FastMCP instance
110
-
111
119
## OpenAPI Integration
112
120
113
121
ToolRegistry supports integration with OpenAPI for interacting with tools using a standardized API interface:
114
122
115
123
```python
116
-
registry.register_from_openapi("http://localhost:8000/") # by providing baseurl
117
-
registry.register_from_openapi("./openapi_spec.json", "http://localhost/") # by providing local OpenAPI spec file and base url
124
+
registry.register_from_openapi("http://localhost:8000/") # Providing base URL
125
+
registry.register_from_openapi("./openapi_spec.json", "http://localhost/") # Providing local OpenAPI specification file and base URL
118
126
119
-
# Get all tools JSON including OpenAPI tools
127
+
# Get all tools' JSON, including OpenAPI tools
120
128
tools_json = registry.get_tools_json()
121
129
```
122
130
123
-
## Registering Hub Tools
131
+
### Note
132
+
133
+
When only providing a base URL, ToolRegistry will attempt a "best effort" auto-discovery to find the OpenAPI specification file (e.g., via `http://<base_url>/openapi.json` or `http://<base_url>/swagger.json`). If discovery fails, ensure the provided URL is correct or download the OpenAPI specification file yourself and register using the file + base URL method:
Hub tools are registered to ToolRegistry using the `register_from_class` method. This allows developers to extend the functionality of ToolRegistry by creating custom tool classes with reusable methods.
141
+
Class tools are registered to ToolRegistry using the `register_from_class` method. This allows developers to extend the functionality of ToolRegistry by creating custom tool classes with reusable methods.
126
142
127
143
Example:
128
144
@@ -154,17 +170,15 @@ print(registry["instance_example.greet"]("Alice")) # Hello, Alice! I'm Bob.
154
170
155
171
### Hub Tools
156
172
157
-
[Latest Available Tools](src/toolregistry/hub/)
158
-
159
-
Hub tools encapsulate commonly used functionalities as methods in classes. These tools are grouped for better organization and reusability.
173
+
[Available Tools](src/toolregistry/hub/)
160
174
161
-
Examples of available hub tools include:
175
+
Hub tools encapsulate commonly used functionalities as methods in classes. Examples of available hub tools include:
162
176
163
177
-**Calculator**: Basic arithmetic, scientific operations, statistical functions, financial calculations, and more.
164
-
-**FileOps**: File manipulation operations like diff generation, patching, and verification.
165
-
-**Filesystem**: Comprehensive file system operations such as directory listing, file reading/writing, and path manipulation.
166
-
-**UnitConverter**: Extensive unit conversion tools for temperature, length, weight, and more.
167
-
-**WebSearch**: Web search functionality supporting multiple search engines including SearxNG and Google.
178
+
-**FileOps**: File manipulation like diff generation, patching, verification, merging, and splitting.
179
+
-**Filesystem**: Comprehensive file system operations such as directory listing, file read/write, path normalization, and querying file attributes.
180
+
-**UnitConverter**: Extensive unit conversions such as temperature, length, weight, volume, etc.
181
+
-**WebSearch**: Web search functionality supporting multiple engines like SearxNG and Google.
We welcome community contributions of new tool classes to ToolRegistry! If you have designs or implementations for other commonly used tools, feel free to submit them through a Pull Request on the [GitHub Repository](https://github.com/yourrepository/toolregistry). Your contributions will help expand the diversity and usability of the tools.
200
+
183
201
## License
184
202
185
203
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
0 commit comments