MCP Server, Typer CLI and vscode tasks in one, provides an easy way to configure your own DevTools and python scripts in a project.
Project description
Toolit
Model Context Protocol (MCP) Server, Typer CLI and Visual Studio Code tasks in one, provides an easy way to configure your own DevTools in a project.
Installation
To get started with Toolit, install the package via pip:
pip install toolit
If you want mcp server support, you can install the optional dependency:
pip install toolit[mcp]
Usage
Add a folder called devtools to your project root. Create python modules, you decide the name, in this folder. Add the tool decorator to functions you want to expose as commands.
# devtools/my_commands.py
from toolit import tool
@tool
def my_command(to_print: str = "Hello, World!") -> None:
"""This is a command that can be run from the CLI."""
print(to_print)
Toolit will automatically discover these modules and make them available as commands.
Now you can run your command from the command line:
toolit --help # To see available commands
toolit my-command --to_print "Hello, Toolit!" # To run your command
You add a command line command with parameter as a devtool, and it will be available as a command in the CLI and in the generated tasks.json file for Visual Studio Code. You do this by:
# devtools/my_cli_commands.py
from toolit import clitool
@clitool
def execute_cli_command(to_print: str = "Hello, World!") -> str:
"""This is a command that can be run from the CLI."""
return "python -c 'print(\"" + to_print + "\")'"
When this command runs from CLI or a generated VS Code task, Toolit executes the returned string in your shell.
Customizing the DevTools Folder
By default, Toolit looks for a folder named devtools in the project root. You can customize this by creating a toolit.ini or use your pyproject.toml file in your project root with the following content:
[toolit]
tools_folder = "tools"
Create the VS code tasks.json file
You can automatically create a tasks.json file for Visual Studio Code to run your ToolIt commands directly from the editor. This is useful for integrating your development tools into your workflow.
To create the .vscode/tasks.json file, run the following command in your terminal:
toolit create-vscode-tasks-json
NOTE: THIS WILL OVERWRITE YOUR EXISTING .vscode/tasks.json FILE IF IT EXISTS!
List parameter inputs in VS Code tasks
VS Code task inputs do not support native list pickers. For tool parameters typed as list[str], list[int], or list[Enum], Toolit generates a promptString input and expects comma-separated values.
Examples:
list[str]:alice, bob, charlielist[int]:1, 2, 3list[MyEnum]: accepts both enum names and enum values, for exampleOPTION_A, Option b
Chaining Commands
You can chain multiple using the @sequential_group_of_tools and @parallel_group_of_tools decorators to create more complex workflows. Functions decorated with these decorators should always return a list of callable functions.
from toolit import tool, sequential_group_of_tools, parallel_group_of_tools
from typing import Callable
@tool
def first_command() -> None:
print("First command executed.")
@tool
def second_command() -> None:
print("Second command executed.")
@sequential_group_of_tools
def my_sequential_commands() -> list[Callable]:
return [first_command, second_command]
@parallel_group_of_tools
def my_parallel_commands() -> list[Callable]:
return [first_command, second_command]
This will create a group of commands in the tasks.json file that can be executed sequentially or in parallel.
Creating Plugins
Toolit supports a plugin system that allows you to create and share your own tools as separate packages. This makes it easy to reuse tools across different projects, without needing to copy and update tools across multiple codebases.
To create a plugin, follow these steps:
- Create a new Python package for your plugin. You can use tools like
setuptools,poetryoruvto set up your package structure. - In your package, create one or several modules where you define your tools using the
@tooldecorator. - You can include your own user-configurations, and load them using the
get_config_valuefunction from thetoolit.configmodule. - Make sure to include
toolitas a dependency in your package'ssetup.pyorpyproject.toml. - Register your plugin with Toolit by adding an entry point in your
setup.pyorpyproject.toml, so Toolit can discover your tools when the package is installed. The entry point is calledtoolit_plugins. - Publish your package to PyPI or install it from a git repository where you need it.
See an example plugin here: toolit-azure-devops-trunk-based-branching
Contributing
We welcome contributions to Toolit! If you have ideas for new features, improvements, or bug fixes, please open an issue or submit a pull request on our GitHub repository. We appreciate your feedback and support in making Toolit even better for the community.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file toolit-0.8.0.tar.gz.
File metadata
- Download URL: toolit-0.8.0.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38ac65eec6aee652705c96d6d2461a52b5ca63871cc43ee57ad6ff4e4a79210e
|
|
| MD5 |
17045106a5dd9a1e91b322a0670448b5
|
|
| BLAKE2b-256 |
3d04ad61e49d157120f98453406e07890268d245f7be8fa4f010bf4a2781a36f
|
Provenance
The following attestation bundles were made for toolit-0.8.0.tar.gz:
Publisher:
release.yaml on martinmoldrup/toolit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
toolit-0.8.0.tar.gz -
Subject digest:
38ac65eec6aee652705c96d6d2461a52b5ca63871cc43ee57ad6ff4e4a79210e - Sigstore transparency entry: 2012687988
- Sigstore integration time:
-
Permalink:
martinmoldrup/toolit@fdaceba9805d4ac32c5a2fc3823922fef1a17bcf -
Branch / Tag:
refs/tags/0.8.0 - Owner: https://github.com/martinmoldrup
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@fdaceba9805d4ac32c5a2fc3823922fef1a17bcf -
Trigger Event:
push
-
Statement type:
File details
Details for the file toolit-0.8.0-py3-none-any.whl.
File metadata
- Download URL: toolit-0.8.0-py3-none-any.whl
- Upload date:
- Size: 20.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55d9dd28087d0d59305f433f167e0d514ed9081c2e98beefef7080c91cbfe064
|
|
| MD5 |
acc34f06bba1f85f8ce8278695db1480
|
|
| BLAKE2b-256 |
bdf1363de3d55f87d84f799703ed0c48fba0a19260bd41944bedd0e24c7d345e
|
Provenance
The following attestation bundles were made for toolit-0.8.0-py3-none-any.whl:
Publisher:
release.yaml on martinmoldrup/toolit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
toolit-0.8.0-py3-none-any.whl -
Subject digest:
55d9dd28087d0d59305f433f167e0d514ed9081c2e98beefef7080c91cbfe064 - Sigstore transparency entry: 2012688088
- Sigstore integration time:
-
Permalink:
martinmoldrup/toolit@fdaceba9805d4ac32c5a2fc3823922fef1a17bcf -
Branch / Tag:
refs/tags/0.8.0 - Owner: https://github.com/martinmoldrup
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@fdaceba9805d4ac32c5a2fc3823922fef1a17bcf -
Trigger Event:
push
-
Statement type: