# MCP Tool Definitions

These tools are exposed to the AI Agent (e.g., Claude) via the Model Context Protocol.

## 1. `search_codebase`
**Description:** Search for code relevant to the query AND understand how it is used. Returns a synthesized summary of matching code snippets and their architectural context (usage, dependencies).
**Input Schema:**
```json
{
  "query": { "type": "string", "description": "The natural language query, e.g. 'how is authentication handled?'" },
  "limit": { "type": "integer", "description": "Max results (default: 5)" },
  "repo": { "type": "string", "description": "Repository name (optional, if multiple repos are indexed)" }
}
```

## 2. `explore_module`
**Description:** Analyze a specific module/file to understand its dependencies and API. Returns what it defines, what it imports, and what uses it.
**Input Schema:**
```json
{
  "path": { "type": "string", "description": "Relative path or filename (e.g., 'src/database.py' or 'User')" }
}
```

## 3. `verify_concept`
**Description:** Verify if a concept, library, or pattern actually exists in the codebase. Use this BEFORE performing deep analysis to avoid hallucinations.
**Input Schema:**
```json
{
  "concept": { "type": "string", "description": "The term to verify (e.g. 'GraphQL', 'Redis', 'UserService')" }
}
```

## Scenario: "Fixing a Bug"
How an agent uses these tools together:

1.  **User**: "The dashboard is crashing on load."
2.  **Agent**: Calls `verify_concept(concept="Dashboard")`.
    *   *Result*: "VERIFICATION SUCCESS: 'Dashboard' found in 3 locations."
3.  **Agent**: Calls `search_codebase(query="dashboard load crash")`.
    *   *Result*: Finds `dashboard.tsx` and `api/stats.ts`.
4.  **Agent**: Calls `explore_module(path="api/stats.ts")`.
    *   *Result*: Shows `api/stats.ts` defined in `packages/backend`, imported by `FrontendRouter`.
5.  **Agent**: "Aha! `FrontendRouter` is calling `stats.ts` incorrectly."
