# How to Contribute Tools

## Contributing a New Tool

Use the tool template:

{% embed url="<https://github.com/Levia-is-us/Levia-tool-template>" %}

### Repository Structure

```
levia_is_us_root/
├── metacognition/
│   ├── ..../
├── engine/
│   ├── ..../
├── memory/
├── test/
├── tools/          # Your tool should be under here
│   ├── tool_1/     # Existing tool 1
│   ├── tool_2/     # Existing tool 2
│   ├── your_tool/  # Your tool
└── other...
```

### Required Tool Structure

When submitting a new capability, ensure it follows this structure:

```
capability-name/
├──* main.py           # Main file you should put your controller in
├──* requirements.txt  # Dependencies
├── security.yaml     # Security declarations generated by Levia
├── tests/            # Test cases generated by Levia
└── docs.md           # Documentation generated by Levia
```

note:  \* is required file you need to prepare for Levia

### Contribution Guidelines

#### 1. Before You Start

* Check existing tools to avoid duplicates
* Read our code of conduct
* Star the repository to show your support
* Join our community Discord for discussions

#### 2. Development Requirements

* Python 3.8 or higher.
* `main.py` should only contain functions for the application's entry point.
* Functional modules must be placed under the `./src` directory.
* All dependencies must be listed in `requirements.txt`.
* Code must comply with linting rules (`flake8`, `black`).
* Achieve 100% test coverage for critical paths.

#### 3. Documentation Requirements

Your main.py must specify:

* External URL endpoints
* Required access permissions
* Data handling patterns
* Resource limitations
* Network requirements
* Security compliance declarations

### Contribution Process

**Step 1: Fork & Branch**

1. Fork the repository
2. Create a feature branch: `feature/capability-name`
3. Implement your capability following our structure

**Step 2: Development**

1. Write clean, documented code
2. Include comprehensive tests
3. Follow our code style guide
4. Document all dependencies

**Step 3: Testing**

1. Run the test suite: `pytest tests/`
2. Ensure code coverage: `pytest --cov`
3. Run linting: `flake8` and `black`
4. Test all examples

**Step 4: Pull Request**

1. Create a detailed PR description
2. Link related issues
3. Complete the PR template
4. Request review from maintainers

### Review Process

1. Automated checks
   * Code style
   * Test coverage
   * Security scanning
   * Dependency verification
2. Manual review
   * Code quality
   * Documentation completeness
   * Security considerations
   * Performance impact

### After Submission

* Respond to review comments promptly
* Be open to feedback and suggestions
* Help maintain your capability
* Update documentation as needed

### Getting Help

* Open an issue for bugs
* Join our [Discord](https://discord.gg/dEZeYt7d) for questions
* Check our FAQ in the wiki
* Contact maintainers for security issues

## How Levia Integrating a New Tool

A guide to the Levia tool integration process for community contributions.

### Process Overview

* **Submission**: Contributors submit tools via Levia Protocol
* **AI Code Review**: Automated quality and security checks
* **Testing**: Automated functionality verification
* **Documentation**: AI-assisted code documentation
* **Integration**: Final approval and system integration

### Detailed Steps

#### 1. Code Review

* Static code analysis for quality metrics
* Security vulnerability scanning
* Best practices compliance check
* Dependencies verification
* Performance impact assessment

#### 2. Quality Assurance

* Automated test case generation
* Function call validation
* Edge case testing
* Response time monitoring
* Error handling verification

#### 3. Documentation & Integration

* Auto-generated documentation
* Usage examples creation
* API specification validation
* Version compatibility check
* Integration pathway mapping

### Integration Requirements

* Clean code practices
* Comprehensive error handling
* Clear documentation
* Performance optimization
* Security compliance
* Versioning support

### Safety Measures

* Sandboxed testing environment
* Rate limiting implementation
* Access control verification
* Data privacy compliance
* Resource usage monitoring

The process ensures community tools meet Levia's standards while maintaining system reliability and security.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://leviaprotocol.gitbook.io/leviaprotocol/building-on-levia/how-to-contribute-tools.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
