Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MCP Tools

Vibe Analyzer provides 11 MCP tools that AI models can call to search code and documentation. Each tool returns a structured response — no document stuffing into the context.

General Concept

In traditional RAG, a search engine finds documents and adds them to the prompt. Vibe Analyzer works differently:

AI model → selects a tool → calls MCP → receives a structured response

Rules for the AI model (embedded in ServerInfo.instructions):

  1. Use tools, respond concisely
  2. One call is enough — no need to call multiple tools in sequence
  3. Only the listed tools

Tool Categories

CategoryToolsPurpose
Adminadmin_syncReindex all projects
Getget_file_content, get_file_astRetrieve file contents and AST
Showshow_projects, show_stats, show_treeProject info: list, statistics, file tree
Search — Codesearch_by_code_imports, search_by_code_functions, search_by_code_classes, search_by_code_variablesCode search: imports, functions, classes, variables
Search — Docssearch_documentation, search_knowledgeMarkdown documentation and knowledge base search

Admin

admin_sync

Triggers reindexing of all projects in the background.

When to call: the user says “update”, “sync”, “reindex”, “refresh”.

Parameters: none.

Response:

{
  "result": "Started",
  "message": "Indexing started. Projects are updating now."
}

Or, if indexing is already running:

{
  "result": "AlreadyRunning",
  "message": "Indexing is already running. Please wait."
}

Get

get_file_content

Returns the full contents of a file.

When to call: the user asks to see file contents, open a file.

Parameters:

ParameterTypeRequiredDescription
pathstringyesFile path. Supports partial matching and wildcards. Can be relative or absolute

Response:

{
  "root": "/path/to/project",
  "path": "src/main.rs",
  "language": "Rust",
  "content": "fn main() {\n println!(\"Hello\");\n}\n"
}

get_file_ast

Returns the full AST of a file: imports, functions, classes, structs, enums, headings.

When to call: the user asks about file structure, functions in a file, AST.

Parameters:

ParameterTypeRequiredDescription
pathstringyesFile path. Can be relative or absolute

Response:

{
  "root": "/path/to/project",
  "path": "src/main.rs",
  "language": "Rust",
  "ast": {
    "header_comments": ["Vibe Analyzer - Main entry point."],
    "imports": ["clap::Parser", "crate::cli::scan::ScanAction"],
    "functions": [{ "signature": "async fn main()", "comments": [] }],
    "structs": [{ "signature": "struct App", "comments": [] }],
    "enums": [{ "signature": "enum Commands", "comments": [] }],
    "tags": [
      "functions",
      "функции",
      "函数",
      "structs",
      "структуры",
      "结构体",
      "enums",
      "перечисления",
      "枚举",
      "imports",
      "импорты",
      "导入",
      "header_comments"
    ]
  }
}

Show

show_projects

Shows all indexed projects with names and brief descriptions.

When to call: the user asks “what projects are available”, “list projects”.

Parameters: none.

Response:

{
  "projects": [
    {
      "path": "/path/to/project",
      "name": "vibe-analyzer",
      "summary": "Agentic RAG engine for code and knowledge bases"
    }
  ],
  "total": 1
}

show_stats

Shows project statistics: language breakdown, file count, lines of code, AST objects.

When to call: the user asks about statistics, file count, codebase size.

Parameters:

ParameterTypeRequiredDescription
targetstringnoProject name. If not specified — statistics for all projects

Response:

{
  "target": null,
  "languages": [
    {
      "language": "Rust",
      "files": 194,
      "lines": 15146,
      "ast_objects": 1631,
      "size_human": "498.26 KB"
    },
    {
      "language": "Markdown",
      "files": 33,
      "lines": 2884,
      "ast_objects": 296,
      "size_human": "102.64 KB"
    }
  ],
  "total": { "files": 287, "lines": 24893, "ast_objects": 2082, "size_human": "755.11 KB" }
}

show_tree

Shows the file and directory tree of a project.

When to call: the user asks about project structure, file tree, folders.

Parameters:

ParameterTypeRequiredDefaultDescription
targetstringnoall projectsProject name
levelintegerno3Maximum depth (1–10)

Response:

{
  "target": "vibe-analyzer",
  "tree": "vibe-analyzer\n|-- Cargo.toml\n|-- src\n|   |-- main.rs\n|   |-- cli\n|   |   |-- mod.rs\n|   |   `-- scan.rs\n|   `-- utils\n|       `-- ...\n`-- tests\n    `-- ...",
  "total_files": 74,
  "total_dirs": 36
}

Search — Code

search_by_code_imports

Finds imports and dependencies in code.

When to call: the user asks about imports, dependencies, libraries used. For “all imports”, use an empty query or *.

Parameters:

ParameterTypeRequiredDefaultDescription
querystringyesSearch query
targetstringnoall projectsProject name
limitintegerno3Maximum results

Response:

{
  "query": "serde",
  "results": [
    {
      "project": "/path/to/project",
      "path": "src/main.rs",
      "language": "Rust",
      "header_comments": ["Vibe Analyzer - Main entry point."],
      "imports": ["serde::Deserialize", "serde::Serialize"]
    }
  ]
}

search_by_code_functions

Finds functions and methods in code.

When to call: the user asks about functions, methods, procedures.

Parameters:

ParameterTypeRequiredDefaultDescription
querystringyesSearch query
targetstringnoall projectsProject name
limitintegerno3Maximum results

Response:

{
  "query": "scan_source",
  "results": [
    {
      "project": "/path/to/project",
      "path": "src/scanner/scanner.rs",
      "language": "Rust",
      "header_comments": ["Core scanning functionality for codebase analysis."],
      "functions": [
        {
          "signature": "pub async fn scan_source(...)",
          "comments": ["Scans a source and returns complete analysis results"]
        }
      ]
    }
  ]
}

search_by_code_classes

Finds classes, structs, interfaces, and traits.

When to call: the user asks about classes, structs, interfaces, types, traits, abstract classes, implements, extends.

Parameters:

ParameterTypeRequiredDefaultDescription
querystringyesSearch query
targetstringnoall projectsProject name
limitintegerno3Maximum results

Response:

{
  "query": "AppConfig",
  "results": [
    {
      "project": "/path/to/project",
      "path": "src/configs/app.rs",
      "language": "Rust",
      "header_comments": ["Application configuration management for vibe-analyzer."],
      "classes": [],
      "structs": [
        {
          "signature": "pub struct AppConfig",
          "comments": ["Main application configuration structure"]
        }
      ],
      "interfaces": []
    }
  ]
}

search_by_code_variables

Finds variables, constants, and enums.

When to call: the user asks about variables, constants, enums, global variables, static fields.

Parameters:

ParameterTypeRequiredDefaultDescription
querystringyesSearch query
targetstringnoall projectsProject name
limitintegerno3Maximum results

Response:

{
  "query": "MAX_SIZE",
  "results": [
    {
      "project": "/path/to/project",
      "path": "src/utils/constants.rs",
      "language": "Rust",
      "header_comments": ["Application constants and configuration defaults."],
      "variables": [
        {
          "signature": "pub const MAX_AST_FILE_SIZE: u64",
          "comments": ["Maximum file size for AST parsing (10 MB)"]
        }
      ],
      "enums": []
    }
  ]
}

Search — Docs

search_documentation

Searches all Markdown documentation files. This is the default tool for non-code questions.

When to call: “who is”, “what is”, “how does”, “rules”, “processes”, “guides”, “legends” questions.

Search priority: Markdown files with knowledge: true in the frontmatter receive a significant boost (5.0) and appear first. This separates the knowledge base (legends, guidelines) from regular documentation. Example frontmatter:

---
knowledge: true
---

Parameters:

ParameterTypeRequiredDefaultDescription
querystringyesSearch query. Supports Cyrillic, Latin, CJK
limitintegerno3Maximum results

Response:

{
  "query": "architecture",
  "results": [
    {
      "project": "/path/to/project",
      "path": "docs/architecture.md",
      "frontmatter": { "title": "Vibe Analyzer Architecture" },
      "headings": [
        { "level": 1, "title": "Architecture", "preview": "Overview of Vibe Analyzer's design" }
      ],
      "links": [{ "text": "Quick Start", "url": "./getting-started.md" }],
      "code_blocks": ["bash", "rust"]
    }
  ]
}

search_knowledge

Alias for search_documentation. Completely identical in parameters and response.

When to call: the user asks about the knowledge base, guidelines, standards, characters.


Anti-Hallucination Protection

Tool Name Aliases (160+)

Models often distort tool names. AliasHandler intercepts the call and replaces the name with the correct one:

ALIAS_HANDLER: Resolving 'search_functions' -> 'search_by_code_functions'

Parameter Normalization

MechanismExample
Wildcard replacement* and ? in query → space
Whitespace trimming" search query ""search query"
query: "*" handlingReturns None (all elements)
limit cappingAlways in 1–10 range. Values ≤ 1 → default (3)
Fuzzy path matchingPartial match and wildcards for path in get_file_content
target normalizationSearch by exact path or unique directory name

Auto Language Detection

When searching documentation, the system detects scripts in the query:

  • Cyrillic → search using Russian tags
  • Latin → search using English tags
  • CJK → search using Chinese tags

Mixed queries search across all detected scripts simultaneously.

Soft Error Handling

Invalid parameters don’t cause errors, they are normalized to safe values:

  • Invalid target → search across all projects
  • limit > 10 → capped to 10
  • Non-existent path → returns an empty result, not an error