protocolbox 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.
- protocolbox-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +39 -0
- protocolbox-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +41 -0
- protocolbox-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +38 -0
- protocolbox-0.1.0/.github/workflows/ci.yml +34 -0
- protocolbox-0.1.0/.github/workflows/deploy_docs.yml +37 -0
- protocolbox-0.1.0/.github/workflows/publish.yml +31 -0
- protocolbox-0.1.0/.gitignore +34 -0
- protocolbox-0.1.0/.protocolbox/SKILL.md +35 -0
- protocolbox-0.1.0/CHANGELOG.md +22 -0
- protocolbox-0.1.0/CODE_OF_CONDUCT.md +56 -0
- protocolbox-0.1.0/CONTRIBUTING.md +206 -0
- protocolbox-0.1.0/LICENSE +21 -0
- protocolbox-0.1.0/PKG-INFO +112 -0
- protocolbox-0.1.0/README.md +87 -0
- protocolbox-0.1.0/SECURITY.md +22 -0
- protocolbox-0.1.0/docs/CNAME +1 -0
- protocolbox-0.1.0/docs/index.html +295 -0
- protocolbox-0.1.0/docs/llms.txt +107 -0
- protocolbox-0.1.0/pyproject.toml +51 -0
- protocolbox-0.1.0/src/protocolbox/__init__.py +3 -0
- protocolbox-0.1.0/src/protocolbox/cli.py +114 -0
- protocolbox-0.1.0/src/protocolbox/server.py +20 -0
- protocolbox-0.1.0/src/protocolbox/tools/__init__.py +7 -0
- protocolbox-0.1.0/src/protocolbox/tools/invoice.py +129 -0
- protocolbox-0.1.0/src/protocolbox/tools/json_healer.py +43 -0
- protocolbox-0.1.0/src/protocolbox/tools/scraper.py +61 -0
- protocolbox-0.1.0/src/protocolbox/tools/utils.py +26 -0
- protocolbox-0.1.0/tests/__init__.py +0 -0
- protocolbox-0.1.0/tests/test_cli.py +170 -0
- protocolbox-0.1.0/tests/test_invoice.py +269 -0
- protocolbox-0.1.0/tests/test_json_healer.py +203 -0
- protocolbox-0.1.0/tests/test_scraper.py +341 -0
- protocolbox-0.1.0/tests/test_server.py +93 -0
- protocolbox-0.1.0/uv.lock +1035 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Report a bug or unexpected behavior
|
|
4
|
+
title: "[BUG] "
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Describe the Bug
|
|
10
|
+
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
## To Reproduce
|
|
14
|
+
|
|
15
|
+
Steps to reproduce the behavior:
|
|
16
|
+
|
|
17
|
+
1. Install ProtocolBox: `pip install protocolbox`
|
|
18
|
+
2. Run: `...`
|
|
19
|
+
3. Call tool: `...`
|
|
20
|
+
4. See error
|
|
21
|
+
|
|
22
|
+
## Expected Behavior
|
|
23
|
+
|
|
24
|
+
A clear description of what you expected to happen.
|
|
25
|
+
|
|
26
|
+
## Actual Behavior
|
|
27
|
+
|
|
28
|
+
What actually happened. Include any error messages or stack traces.
|
|
29
|
+
|
|
30
|
+
## Environment
|
|
31
|
+
|
|
32
|
+
- **OS**: [e.g., macOS 14, Ubuntu 22.04]
|
|
33
|
+
- **Python version**: [e.g., 3.11.8]
|
|
34
|
+
- **ProtocolBox version**: [e.g., 0.1.0]
|
|
35
|
+
- **Agent**: [e.g., Claude, Gemini, Antigravity]
|
|
36
|
+
|
|
37
|
+
## Additional Context
|
|
38
|
+
|
|
39
|
+
Add any other context, screenshots, or logs here.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Suggest a new tool or improvement
|
|
4
|
+
title: "[FEATURE] "
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Summary
|
|
10
|
+
|
|
11
|
+
A clear one-line description of the feature or tool you'd like.
|
|
12
|
+
|
|
13
|
+
## Use Case
|
|
14
|
+
|
|
15
|
+
Describe the problem this solves or the scenario where this would be useful.
|
|
16
|
+
|
|
17
|
+
**Who benefits?** (e.g., agents doing web research, agents generating documents)
|
|
18
|
+
|
|
19
|
+
## Proposed Solution
|
|
20
|
+
|
|
21
|
+
Describe how you'd like this to work:
|
|
22
|
+
|
|
23
|
+
- **Tool name**: `your_tool_name`
|
|
24
|
+
- **Input**: What parameters does it take?
|
|
25
|
+
- **Output**: What does it return?
|
|
26
|
+
- **Dependencies**: Any new libraries needed?
|
|
27
|
+
|
|
28
|
+
## Example Usage
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
# How an agent would use this tool
|
|
32
|
+
result = your_tool_name(param="value")
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Alternatives Considered
|
|
36
|
+
|
|
37
|
+
List any alternative approaches you've considered.
|
|
38
|
+
|
|
39
|
+
## Additional Context
|
|
40
|
+
|
|
41
|
+
Any other context, mockups, or references.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
Brief description of what this PR does and why.
|
|
4
|
+
|
|
5
|
+
Closes #<!-- issue number -->
|
|
6
|
+
|
|
7
|
+
## Type of Change
|
|
8
|
+
|
|
9
|
+
- [ ] 🐛 Bug fix (non-breaking change fixing an issue)
|
|
10
|
+
- [ ] ✨ New feature / tool (non-breaking change adding functionality)
|
|
11
|
+
- [ ] 💥 Breaking change (fix or feature that would break existing functionality)
|
|
12
|
+
- [ ] 📝 Documentation update
|
|
13
|
+
- [ ] 🧪 Test improvement
|
|
14
|
+
- [ ] 🔧 Refactor / maintenance
|
|
15
|
+
|
|
16
|
+
## Changes Made
|
|
17
|
+
|
|
18
|
+
-
|
|
19
|
+
-
|
|
20
|
+
-
|
|
21
|
+
|
|
22
|
+
## Testing
|
|
23
|
+
|
|
24
|
+
- [ ] All existing tests pass (`pytest tests/ -v`)
|
|
25
|
+
- [ ] New tests added for this change
|
|
26
|
+
- [ ] Edge cases covered (empty input, unicode, large data, errors)
|
|
27
|
+
- [ ] Lint is clean (`ruff check .`)
|
|
28
|
+
|
|
29
|
+
## Documentation
|
|
30
|
+
|
|
31
|
+
- [ ] README updated (if adding a tool)
|
|
32
|
+
- [ ] `docs/llms.txt` updated (if adding a tool)
|
|
33
|
+
- [ ] Docstrings added with type hints
|
|
34
|
+
- [ ] CONTRIBUTING.md followed
|
|
35
|
+
|
|
36
|
+
## Screenshots / Output (if applicable)
|
|
37
|
+
|
|
38
|
+
<!-- Add any relevant screenshots or command output here -->
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "main", "master" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ "main", "master" ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.11", "3.12"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v5
|
|
21
|
+
|
|
22
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: uv sync --all-extras --dev
|
|
29
|
+
|
|
30
|
+
- name: Lint with Ruff
|
|
31
|
+
run: uv run ruff check .
|
|
32
|
+
|
|
33
|
+
- name: Test with pytest
|
|
34
|
+
run: uv run pytest tests/
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Deploy Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main", "master"]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
pages: write
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: "pages"
|
|
15
|
+
cancel-in-progress: false
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
deploy:
|
|
19
|
+
environment:
|
|
20
|
+
name: github-pages
|
|
21
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- name: Checkout
|
|
25
|
+
uses: actions/checkout@v4
|
|
26
|
+
|
|
27
|
+
- name: Setup Pages
|
|
28
|
+
uses: actions/configure-pages@v5
|
|
29
|
+
|
|
30
|
+
- name: Upload artifact
|
|
31
|
+
uses: actions/upload-pages-artifact@v3
|
|
32
|
+
with:
|
|
33
|
+
path: './docs'
|
|
34
|
+
|
|
35
|
+
- name: Deploy to GitHub Pages
|
|
36
|
+
id: deployment
|
|
37
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
pypi-publish:
|
|
9
|
+
name: Upload release to PyPI
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
environment:
|
|
12
|
+
name: pypi
|
|
13
|
+
url: https://pypi.org/p/protocolbox
|
|
14
|
+
permissions:
|
|
15
|
+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v5
|
|
21
|
+
|
|
22
|
+
- name: Set up Python
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: "3.11"
|
|
26
|
+
|
|
27
|
+
- name: Build package
|
|
28
|
+
run: uv build
|
|
29
|
+
|
|
30
|
+
- name: Publish package distributions to PyPI
|
|
31
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Distribution / packaging
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
*.egg
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
env/
|
|
16
|
+
|
|
17
|
+
# Ruff
|
|
18
|
+
.ruff_cache/
|
|
19
|
+
|
|
20
|
+
# Pytest
|
|
21
|
+
.pytest_cache/
|
|
22
|
+
|
|
23
|
+
# IDE
|
|
24
|
+
.vscode/
|
|
25
|
+
.idea/
|
|
26
|
+
*.swp
|
|
27
|
+
*.swo
|
|
28
|
+
|
|
29
|
+
# OS
|
|
30
|
+
.DS_Store
|
|
31
|
+
Thumbs.db
|
|
32
|
+
|
|
33
|
+
# Temp
|
|
34
|
+
/tmp/
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: protocolbox
|
|
3
|
+
description: >
|
|
4
|
+
Standard Library of verified tools for AI Agents.
|
|
5
|
+
Tools: scrape(url), heal_json(str), generate_invoice(dict).
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# ProtocolBox
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install protocolbox
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
Start the MCP server:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
protocolbox start
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or with uv:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
uv run protocolbox start
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Available Tools
|
|
31
|
+
|
|
32
|
+
- **scrape(url: str) -> str** — Fetch a web page and return clean Markdown.
|
|
33
|
+
- **heal_json(broken_json: str) -> dict** — Fix malformed JSON from LLM output.
|
|
34
|
+
- **generate_invoice(data: dict) -> str** — Generate a PDF invoice.
|
|
35
|
+
Requires `client_name` and `total` in data.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-02-14
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **MCP Server**: FastMCP-based server implementation.
|
|
12
|
+
- **Tools**:
|
|
13
|
+
- `scrape(url)`: Fetch web pages and return clean Markdown.
|
|
14
|
+
- `heal_json(broken_json)`: Repair malformed JSON output from LLMs.
|
|
15
|
+
- `generate_invoice(data)`: Create PDF invoices from structured data.
|
|
16
|
+
- **CLI**: `protocolbox init` and `protocolbox start` commands.
|
|
17
|
+
- **Documentation**:
|
|
18
|
+
- `README.md` with badges and quick start.
|
|
19
|
+
- `docs/llms.txt` for AI agent consumption.
|
|
20
|
+
- `docs/index.html` landing page.
|
|
21
|
+
- `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, `SECURITY.md`.
|
|
22
|
+
- **Testing**: Comprehensive test suite with 110+ tests.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment:
|
|
18
|
+
|
|
19
|
+
* Using welcoming and inclusive language
|
|
20
|
+
* Being respectful of differing viewpoints and experiences
|
|
21
|
+
* Gracefully accepting constructive criticism
|
|
22
|
+
* Focusing on what is best for the community
|
|
23
|
+
* Showing empathy towards other community members
|
|
24
|
+
|
|
25
|
+
Examples of unacceptable behavior:
|
|
26
|
+
|
|
27
|
+
* The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
28
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
29
|
+
* Public or private harassment
|
|
30
|
+
* Publishing others' private information without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
32
|
+
|
|
33
|
+
## Enforcement Responsibilities
|
|
34
|
+
|
|
35
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
36
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
37
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
38
|
+
or harmful.
|
|
39
|
+
|
|
40
|
+
## Scope
|
|
41
|
+
|
|
42
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
43
|
+
an individual is officially representing the community in public spaces.
|
|
44
|
+
|
|
45
|
+
## Enforcement
|
|
46
|
+
|
|
47
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
48
|
+
reported to the project maintainer at **anurag@protocolbox.in**.
|
|
49
|
+
|
|
50
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
51
|
+
|
|
52
|
+
## Attribution
|
|
53
|
+
|
|
54
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
|
|
55
|
+
version 2.1, available at
|
|
56
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Contributing to ProtocolBox
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to ProtocolBox! We welcome contributions from everyone.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Getting Started](#getting-started)
|
|
8
|
+
- [Development Setup](#development-setup)
|
|
9
|
+
- [Project Structure](#project-structure)
|
|
10
|
+
- [Adding a New Tool](#adding-a-new-tool)
|
|
11
|
+
- [Code Standards](#code-standards)
|
|
12
|
+
- [Testing](#testing)
|
|
13
|
+
- [Pull Request Process](#pull-request-process)
|
|
14
|
+
- [Reporting Issues](#reporting-issues)
|
|
15
|
+
|
|
16
|
+
## Getting Started
|
|
17
|
+
|
|
18
|
+
1. **Fork the repository** on GitHub.
|
|
19
|
+
2. **Clone your fork** locally:
|
|
20
|
+
```bash
|
|
21
|
+
git clone https://github.com/ianuragbhatt/protocolbox.git
|
|
22
|
+
cd protocolbox
|
|
23
|
+
```
|
|
24
|
+
3. **Create a branch** for your work:
|
|
25
|
+
```bash
|
|
26
|
+
git checkout -b feature/your-feature-name
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Development Setup
|
|
30
|
+
|
|
31
|
+
ProtocolBox requires **Python 3.11+**. We recommend using [uv](https://docs.astral.sh/uv/) for dependency management.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Install in editable mode with dev dependencies
|
|
35
|
+
pip install -e ".[dev]"
|
|
36
|
+
|
|
37
|
+
# Or with uv
|
|
38
|
+
uv pip install -e ".[dev]"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Verify your setup:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pytest tests/ -v # All tests should pass
|
|
45
|
+
ruff check . # No lint errors
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Project Structure
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
protocolbox/
|
|
52
|
+
├── src/protocolbox/
|
|
53
|
+
│ ├── __init__.py # Package version
|
|
54
|
+
│ ├── server.py # FastMCP server engine
|
|
55
|
+
│ ├── cli.py # CLI (init + start commands)
|
|
56
|
+
│ └── tools/
|
|
57
|
+
│ ├── __init__.py # Tool exports
|
|
58
|
+
│ ├── utils.py # Shared utilities (HTTP client)
|
|
59
|
+
│ ├── scraper.py # scrape() tool
|
|
60
|
+
│ ├── json_healer.py # heal_json() tool
|
|
61
|
+
│ └── invoice.py # generate_invoice() tool
|
|
62
|
+
├── tests/ # Test suite (mirrors tool structure)
|
|
63
|
+
├── docs/ # Documentation & landing page
|
|
64
|
+
├── pyproject.toml # Project config
|
|
65
|
+
├── CONTRIBUTING.md # ← You are here
|
|
66
|
+
└── CODE_OF_CONDUCT.md
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Adding a New Tool
|
|
70
|
+
|
|
71
|
+
ProtocolBox is designed to make adding new tools straightforward:
|
|
72
|
+
|
|
73
|
+
### 1. Create the tool file
|
|
74
|
+
|
|
75
|
+
Create `src/protocolbox/tools/your_tool.py`:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
"""Description of your tool."""
|
|
79
|
+
|
|
80
|
+
from protocolbox.server import mcp
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
@mcp.tool()
|
|
84
|
+
def your_tool_name(param: str) -> str:
|
|
85
|
+
"""Clear docstring describing what the tool does.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
param: Description of the parameter.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
Description of the return value.
|
|
92
|
+
"""
|
|
93
|
+
# Your implementation here
|
|
94
|
+
return result
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 2. Register the tool
|
|
98
|
+
|
|
99
|
+
Add the import to `src/protocolbox/server.py`:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import protocolbox.tools.your_tool # noqa: F401, E402
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
And export it from `src/protocolbox/tools/__init__.py`.
|
|
106
|
+
|
|
107
|
+
### 3. Write tests
|
|
108
|
+
|
|
109
|
+
Create `tests/test_your_tool.py` with:
|
|
110
|
+
- Happy-path tests
|
|
111
|
+
- Edge cases (empty input, unicode, very large input)
|
|
112
|
+
- Error handling tests
|
|
113
|
+
|
|
114
|
+
### 4. Update documentation
|
|
115
|
+
|
|
116
|
+
- Add the tool to `docs/llms.txt`
|
|
117
|
+
- Add a card to `docs/index.html`
|
|
118
|
+
- Update the `README.md` tool table
|
|
119
|
+
|
|
120
|
+
## Code Standards
|
|
121
|
+
|
|
122
|
+
We enforce consistent code quality with **Ruff**:
|
|
123
|
+
|
|
124
|
+
| Rule | Setting |
|
|
125
|
+
|------|---------|
|
|
126
|
+
| Line length | 88 characters |
|
|
127
|
+
| Target version | Python 3.11 |
|
|
128
|
+
| Lint rules | `E` (pycodestyle), `F` (pyflakes), `I` (isort) |
|
|
129
|
+
| Type hints | **Mandatory** on all public functions |
|
|
130
|
+
|
|
131
|
+
### Before submitting
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Fix auto-fixable issues
|
|
135
|
+
ruff check . --fix
|
|
136
|
+
|
|
137
|
+
# Verify clean
|
|
138
|
+
ruff check .
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Style guidelines
|
|
142
|
+
|
|
143
|
+
- **Type hints are mandatory** on all function signatures.
|
|
144
|
+
- **Docstrings** are required on all public functions (Google style).
|
|
145
|
+
- **Error handling**: Tools should return error strings/dicts, not raise exceptions.
|
|
146
|
+
- **No print statements**: Use `typer.echo()` in CLI code only.
|
|
147
|
+
|
|
148
|
+
## Testing
|
|
149
|
+
|
|
150
|
+
We use **pytest** for testing. Our test suite aims for comprehensive edge-case coverage.
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Run all tests
|
|
154
|
+
pytest tests/ -v
|
|
155
|
+
|
|
156
|
+
# Run a specific test file
|
|
157
|
+
pytest tests/test_scraper.py -v
|
|
158
|
+
|
|
159
|
+
# Run with coverage (install pytest-cov first)
|
|
160
|
+
pytest tests/ --cov=protocolbox --cov-report=term-missing
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Test expectations
|
|
164
|
+
|
|
165
|
+
- **Every tool must have tests** covering:
|
|
166
|
+
- Normal/happy path
|
|
167
|
+
- Edge cases (empty, unicode, very large, special characters)
|
|
168
|
+
- Error handling (invalid input, network errors)
|
|
169
|
+
- **Mock external calls** (HTTP, filesystem) — never make real network requests in tests.
|
|
170
|
+
- **Clean up** generated files (e.g., PDFs in `/tmp/`).
|
|
171
|
+
|
|
172
|
+
## Pull Request Process
|
|
173
|
+
|
|
174
|
+
1. **Ensure all tests pass** and **ruff is clean**.
|
|
175
|
+
2. **Write clear commit messages** following conventional commits:
|
|
176
|
+
- `feat: add new_tool for X`
|
|
177
|
+
- `fix: handle edge case in scraper`
|
|
178
|
+
- `docs: update README with new tool`
|
|
179
|
+
- `test: add edge cases for json_healer`
|
|
180
|
+
3. **Open a PR** against `main` with:
|
|
181
|
+
- A description of what changed and why.
|
|
182
|
+
- Link to any related issue.
|
|
183
|
+
4. **Address review feedback** promptly.
|
|
184
|
+
|
|
185
|
+
### PR checklist
|
|
186
|
+
|
|
187
|
+
- [ ] All tests pass (`pytest tests/ -v`)
|
|
188
|
+
- [ ] Lint is clean (`ruff check .`)
|
|
189
|
+
- [ ] New tools have comprehensive tests
|
|
190
|
+
- [ ] Documentation is updated (README, llms.txt)
|
|
191
|
+
- [ ] Commit messages follow conventional format
|
|
192
|
+
|
|
193
|
+
## Reporting Issues
|
|
194
|
+
|
|
195
|
+
Use the [GitHub issue templates](.github/ISSUE_TEMPLATE/) to report:
|
|
196
|
+
|
|
197
|
+
- **Bugs**: Include reproduction steps, expected vs actual behavior, and your environment.
|
|
198
|
+
- **Feature requests**: Describe the tool or improvement and the use case.
|
|
199
|
+
|
|
200
|
+
## Questions?
|
|
201
|
+
|
|
202
|
+
Open a [discussion](https://github.com/ianuragbhatt/protocolbox/discussions) or reach out to the maintainers.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
Thank you for helping build the Standard Library for the Agentic Web! 🚀
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Anurag Bhatt
|
|
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.
|