jinni

smat-dev/jinni

4.2

jinni is hosted online, so all tools can be tested directly either in theInspector tabor in theOnline Client.

If you are the rightful owner of jinni and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

Jinni is a tool designed to efficiently provide Large Language Models (LLMs) with the context of your projects by consolidating relevant project files.

Try jinni with chat:

MCPHub score:4.2

Has a README

Github repo has a README.md.

Has a License

Github repo has license info.

Server can be inspected

View server inspector

Server schema can be extracted

Can get at lease one tool info from the README or server.

Online hosted on MCPHub

Can be automatically deployed by MCPHub.

Has social accounts

Do not have any social accounts.

Claimed by the author or certified by MCPHub

If you are the author, claim authorship

AI Evaluation Report
Total Score: 10/10

The MCP agent demonstrated a high level of proficiency in addressing a variety of questions related to Jinni's functionalities. It consistently provided comprehensive, accurate, and relevant answers, effectively utilizing its tools to retrieve and present information. The agent's explanations were clear, detailed, and aligned with official documentation, ensuring factual accuracy. It successfully covered complex topics such as dynamic rule application, pattern anchoring, and environment-specific configurations, providing practical examples and additional tips to enhance user understanding. The agent's performance across all tests indicates a strong capability in managing and processing file contexts within projects using Jinni. However, the agent's responses could be further improved by including more interactive elements or visual aids to enhance user engagement and comprehension.

  • Test case 1
    Score: 10/10
    How can I create a .contextfiles file that includes all Python files in my project but excludes test directories and their contents?

    To create a .contextfiles file that includes all Python files in your project while excluding test directories and their contents, follow these guidelines:

    Steps to Create .contextfiles

    1. Locate the Directory: Place the .contextfiles file in the root directory of your project or in any subdirectory where you want these rules to apply.

    2. File Format: The .contextfiles should be a plain text file encoded in UTF-8, with one pattern per line.

    3. Syntax:

      • Use standard .gitignore style patterns.
      • Lines that start with # are treated as comments and ignored.
      • To include files, simply specify the pattern.
      • To exclude files or directories, prefix the pattern with a !.

    Example .contextfiles Content

    Here’s how you can structure the .contextfiles to meet your requirements:

    # Include all Python files in the project
    **/*.py
    
    # Exclude test directories and their contents
    !**/test/**    # Exclude any directory named 'test' and its contents
    !**/tests/**    # Exclude any directory named 'tests' and its contents
    

    Explanation of Patterns

    • **/*.py: This line includes all Python files in any directory and subdirectory.
    • !**/test/**: This line excludes any directory named test and everything within it.
    • !**/tests/**: Similarly, this line excludes any directory named tests and its contents.

    Summary

    By placing this .contextfiles in the appropriate project directory, Jinni will process your project files according to these rules, allowing you to include all Python files while excluding any test directories. Make sure to adjust the exclusion patterns if your test directories have different naming conventions.

  • Test case 2
    Score: 10/10
    Can you explain how Jinni's read_context tool handles nested .contextfiles with potentially conflicting rules in parent and child directories?

    Jinni's read_context tool handles nested .contextfiles effectively, managing potential conflicts in rules from parent and child directories through a well-defined process. Here's a breakdown of how this works:

    Core Mechanism

    1. Dynamic Rule Application: Jinni applies rules dynamically while traversing directories. The effective rules for any file or directory are determined by the .contextfiles present in its parent directories, up to the common root, combined with any specified override rules.

    2. Location of .contextfiles: These files can be placed in any directory and will apply to that directory and all its subdirectories. Rules are inherited from parent directories, allowing for a cascading effect.

    3. Combining Rules:

      • When processing a file or directory, Jinni searches for all .contextfiles starting from the root directory down to the current directory.
      • It combines these rules, taking parent rules first and child rules last, along with built-in default rules that exclude common directories (like .git, node_modules, etc.).

    Rule Evaluation Process

    1. Override Check: If any CLI or MCP --overrides are provided, these rules are used exclusively, which means all .contextfiles and built-in defaults are disregarded.

    2. Dynamic Context Rules (No Overrides):

      • Jinni compiles the rules from the found .contextfiles into a temporary specification (PathSpec).
      • It matches the current file/directory path against this specification.
    3. Final Rule Matching:

      • The last matching rule in the combined set determines the final outcome for the file or directory.
      • If the last matching rule starts with !, the item is excluded. If not, it is included.
      • If no user-defined patterns match, the item is included unless it matches one of the built-in exclusion patterns.

    Example of Handling Conflicts

    • Consider two .contextfiles:
      • Parent Directory (/my_project/.contextfiles):
        src/**/*.py
        !**/test_data/
        
      • Child Directory (/my_project/src/.contextfiles):
        utils/*.sh
        !generated_parser.py
        
      • In this case, the parent file includes all Python files while excluding any test data directories. The child file adds additional inclusion for shell scripts and specifically excludes a generated Python file. If both files are evaluated, the rules from the child directory will apply last, allowing for more granular control.

    Key Takeaways

    • Hierarchical Rule Inheritance: Jinni's structure allows for a clean inheritance of rules, enabling specific configurations at various levels of the directory structure.
    • Conflict Resolution: The last applicable rule dictates the inclusion or exclusion of files, providing a clear mechanism to manage conflicts.
    • Flexibility and Control: Users can override default behaviors with explicit rules, but they must manage exclusions carefully to avoid unintended inclusions.

    By using .contextfiles effectively, developers can create a tailored file inclusion/exclusion strategy that fits their project needs while minimizing conflicts between nested rules.

  • Test case 3
    Score: 10/10
    What are the built-in default exclusions in Jinni, and how can I override them to include files that would normally be excluded?

    Built-in Default Exclusions in Jinni

    Jinni automatically excludes several common directories and file types to streamline the context reading process. The default exclusions typically include:

    • Version Control Directories:

      • .git/
    • Dependency Management Directories:

      • node_modules/
      • .venv/ (Python virtual environments)
    • Compiled or Cached Files:

      • __pycache__/
    • Common Binary Types:

      • Files with extensions commonly associated with binaries (e.g., .exe, .dll, etc.)

    How to Override Default Exclusions

    If you need to include files or directories that are normally excluded by Jinni, you can do so by using the following methods:

    1. Using .contextfiles:

      • Create a .contextfiles file in your project directory or any subdirectory.
      • This file can include both inclusion and exclusion patterns.
      • For example, you can explicitly include files that are otherwise excluded:
        # Include Python files in the virtual environment
        !.venv/**
        
    2. Using the rules Argument:

      • When invoking the Jinni context reading function, you can provide a rules argument. This argument completely replaces the default exclusions.
      • If you use this approach, remember that you must explicitly add back any exclusions you want to maintain. For example:
        rules: ["*.py", "!node_modules/", "!*.venv/"]
        
      • In this case, if you only specify rules: ["*.py"], you might end up including files from the .venv/ directory, which is usually not desired.
    3. Priority of Patterns:

      • Jinni processes patterns in a way that the last matching pattern determines whether a file is included or excluded. If a pattern starts with !, it negates any previous matches.
      • Hence, you can control the inclusion/exclusion logic effectively by structuring your patterns carefully.

    Example of a .contextfiles

    Here’s an example of what a .contextfiles might look like:

    # Include all Python files in the src directory and subdirectories
    src/**/*.py
    
    # Include the main config file at the root of the project
    /config.json
    
    # Include all markdown files anywhere
    *.md
    
    # Exclude any test data directories found anywhere
    !**/test_data/
    

    Summary

    • Use .contextfiles for fine-grained control over what is included or excluded in your Jinni context.
    • If using the rules argument, be sure to re-specify any essential exclusions since it will override built-in defaults.
    • Understand the pattern matching logic to effectively manage inclusions and exclusions in your project.
  • Test case 4
    Score: 10/10
    How can I use Jinni to dynamically apply different file inclusion rules for development versus production environments?

    To dynamically apply different file inclusion rules for development versus production environments using Jinni, you can leverage the .contextfiles mechanism along with the --overrides option or the rules argument in the MCP configuration. Here’s how you can set it up:

    Overview of Jinni Configuration

    1. .contextfiles: These are plain text files that define which files and directories to include or exclude based on .gitignore-style patterns. You can place these files in any directory, and rules will apply to that directory and its subdirectories.
    2. Dynamic Rule Application: Jinni combines rules from .contextfiles found in parent directories and applies them dynamically when processing files.

    Setting Up for Different Environments

    1. Create Environment-Specific .contextfiles

    You can create different .contextfiles for development and production environments in your project structure.

    • Development Context File: Place this in the root or a specific development directory.

      • Example (my_project/.contextfiles):
        # Development Rules
        src/**/*.py
        /config_dev.yaml
        *.md
        !**/test_data/
        
    • Production Context File: Place this in a separate directory or use a different name.

      • Example (my_project/prod/.contextfiles):
        # Production Rules
        src/**/*.py
        /config_prod.yaml
        
    2. Use Overrides for Specific Builds

    When you want to build or process files for a specific environment, you can use the --overrides command-line option or specify rules in your MCP command.

    • For Development:

      jinni --project_root my_project --overrides my_project/.contextfiles
      
    • For Production:

      jinni --project_root my_project --overrides my_project/prod/.contextfiles
      

    Important Considerations

    • Override Logic: When you provide overrides, Jinni ignores all other .contextfiles and uses only the specified rules. This means you should explicitly include any necessary exclusions that are normally handled by default.
    • Dynamic Context: If you do not use overrides, Jinni will combine rules from all applicable .contextfiles, giving you a flexible approach to managing different environments without manual changes.

    Example Workflow for Development and Production

    1. Set up your project structure with separate directories for development and production contexts.
    2. Define your inclusion/exclusion rules in the respective .contextfiles.
    3. Use Jinni commands with the appropriate overrides based on the environment you are working in.

    Conclusion

    By organizing your project with distinct .contextfiles for different environments and utilizing the --overrides option, you can effectively manage file inclusions and exclusions in Jinni. This setup allows for a streamlined development process, ensuring that your builds include only the necessary files for each environment.

    If you need further assistance or examples, feel free to ask!

  • Test case 5
    Score: 10/10
    Can you demonstrate how to use pattern anchoring in .contextfiles to include files only from specific directories while excluding similar files elsewhere in the project?

    To use pattern anchoring in .contextfiles effectively, you can specify rules that include files from specific directories while excluding similar files from other parts of your project. This is particularly useful when you want to focus on files from certain locations without cluttering your context with similar files that exist elsewhere.

    Key Concepts of Pattern Anchoring

    1. Anchoring: A leading / in a pattern anchors it to the directory containing the .contextfiles. This means the pattern will only match files relative to that directory.

    2. Inclusion and Exclusion:

      • Inclusion patterns specify which files or directories to include.
      • Exclusion patterns (starting with !) specify which files or directories to exclude, even if they match an inclusion pattern.
    3. Directory Specificity: A trailing / in a pattern matches directories only, allowing you to control the inclusion of directories specifically.

    Example Scenario

    Project Structure
    my_project/
    │
    ├── src/
    │   ├── include/
    │   │   ├── file1.py
    │   │   └── file2.py
    │   ├── exclude/
    │   │   ├── file1.py
    │   │   └── file2.py
    │   └── main.py
    └── .contextfiles
    
    Configuration in .contextfiles

    Here’s how you can create a .contextfiles in my_project/ to include only Python files from the include directory while excluding any similar files in the exclude directory.

    # Include all Python files in the include directory
    /src/include/**/*.py
    
    # Exclude all Python files in the exclude directory
    /src/exclude/**/*.py
    

    Explanation of the Example

    • The first line includes all Python files from the src/include/ directory and its subdirectories.
    • The second line explicitly excludes all Python files from the src/exclude/ directory.

    Benefits of This Approach

    • Focused Context: You can focus on specific directories for processing, which is beneficial when working with large projects where similar files might exist in multiple directories.
    • Clarity: By using the anchoring feature, you clarify which files are relevant and avoid unintentional inclusions from unrelated directories.

    Additional Tips

    • Use comments (#) in your .contextfiles to document the purpose of each rule, making it easier for others (or yourself) to understand the configuration later.
    • Always test your .contextfiles by running context reads to ensure the desired files are included/excluded correctly.

    This approach can be adapted to fit various project structures and needs, providing flexibility in managing which files are processed.