Sharpitect: Semantic C# Navigation
Overview
Sharpitect provides semantic understanding of C# codebases through MCP tools. Always prefer Sharpitect MCP tools over text-based searching (Grep/Glob) when working with C# code.
When to Use Sharpitect Tools
Use Sharpitect tools as your first choice for:
Finding Declarations
- Instead of:
Grep with pattern matching
- Use:
search_declarations to find classes, interfaces, methods, properties by name
- Benefits: Exact semantic matches, understands C# syntax, filters by declaration kind
Understanding Type Hierarchies
- Instead of: Reading class files and searching for base classes
- Use:
get_inheritance with direction: descendants (implementations) or ancestors (base types)
- Benefits: Complete hierarchy tree, includes interfaces and abstract classes
Finding Method/Property Usage
- Instead of:
Grep for method names (which may match strings, comments, etc.)
- Use:
get_callers to find what calls a method, or get_usages for all references
- Benefits: Accurate call sites only, no false positives from comments or strings
Understanding Dependencies
- Instead of: Reading code to find what a method calls
- Use:
get_callees to see all methods/properties a method uses
- Benefits: Complete dependency graph, includes transitive calls
Exploring Code Structure
- Instead of:
Glob to list files and Read to understand structure
- Use:
get_tree to see containment hierarchy, get_children for members
- Benefits: Semantic structure, filtered by kind, shows relationships
Finding Project Dependencies
- Instead of: Reading .csproj files or searching for using statements
- Use:
get_dependencies (what a project references) or get_dependents (what depends on a project)
- Benefits: Complete project graph, includes transitive dependencies
Tool Selection Guide
Use Sharpitect MCP tools for:
- Finding C# elements: Classes, methods, properties, interfaces
- Understanding relationships: Inheritance, calls, dependencies, usages
- Navigating structure: Hierarchies, containment, project organization
- Precise queries: "Find all implementations of IFoo"
Fall back to generic tools only when:
- Reading source code: Use
Read to see actual implementation
- Searching non-code content: Comments, strings, XML docs, config files
- Cross-language search: JavaScript, JSON, Markdown files
- Pattern matching: Complex regex patterns not supported by Sharpitect
Common Workflows
Workflow 1: "Find implementations of an interface"
1. search_declarations(query="IGraphRepository", kind="interface")
2. get_inheritance(id="...", direction="descendants")
Workflow 2: "Where is this method called?"
1. search_declarations(query="LoadGraph", kind="method")
2. get_callers(id="...", depth=1)
Workflow 3: "What does this class depend on?"
1. search_declarations(query="SqliteGraphRepository", kind="class")
2. get_relationships(id="...", relationshipKind="uses", direction="outgoing")
Workflow 4: "Show me all classes in a namespace"
1. search_declarations(query="Sharpitect.Analysis.Graph", kind="namespace")
2. get_children(id="...", kind="class")
Workflow 5: "Find all methods that call a specific method"
1. search_declarations(query="SaveNode", kind="method")
2. get_usages(id="...", usageKind="call")
Key Sharpitect Tools Reference
| Tool |
Purpose |
When to Use |
search_declarations |
Find declarations by name |
First step for finding any C# element |
get_inheritance |
Get type hierarchy |
Understanding class/interface relationships |
get_callers |
Find who calls a method |
Tracing method usage upstream |
get_callees |
Find what a method calls |
Understanding method dependencies |
get_usages |
Find all references |
Comprehensive usage analysis |
get_relationships |
Get all relationships |
Exploring complex relationships |
get_dependencies |
Project dependencies |
Understanding project references |
get_tree |
Containment hierarchy |
Exploring code structure |
get_signature |
Type/method signature |
Getting detailed type information |
get_file_declarations |
Declarations in a file |
Quick overview of file contents |
Important Notes
- Always use Sharpitect first: Even if you think Grep might work, try Sharpitect first
- Combine with Read: Use Sharpitect to find locations, then
Read to see implementation
- Be specific with kinds: Use
kind parameter to filter (class, interface, method, property, etc.)
- Use depth wisely: For
get_callers/get_callees, start with depth=1, increase if needed
- Check the database: If Sharpitect returns no results, the codebase may not be analyzed yet (run
sharpitect analyze)
Examples
❌ Don't do this:
Grep pattern="class.*IGraphRepository" to find implementations
✅ Do this instead:
1. search_declarations(query="IGraphRepository", kind="interface", matchMode="exact")
2. get_inheritance(id="...", direction="descendants")
❌ Don't do this:
Grep pattern="LoadGraph\\(" to find method calls
✅ Do this instead:
1. search_declarations(query="LoadGraph", kind="method")
2. get_callers(id="...")
❌ Don't do this:
Read all files in a namespace to understand structure
✅ Do this instead:
1. search_declarations(query="Sharpitect.Analysis", kind="namespace")
2. get_tree(rootId="...", maxDepth=2)
Summary
When working with C# code, think "Sharpitect first, generic tools second." Sharpitect understands C# semantics and provides accurate, efficient navigation. Only fall back to Grep/Glob/Read when you need non-semantic searches or actual source code content.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: use-sharpitect3description: Navigate and analyze C# codebases using Sharpitect's semantic tools. Use when searching for C# declarations, understanding inheritance, finding method callers/callees, or exploring code relationships in .NET projects. Use when this capability is needed.4---56# Sharpitect: Semantic C# Navigation78## Overview910Sharpitect provides semantic understanding of C# codebases through MCP tools. **Always prefer Sharpitect MCP tools over text-based searching (Grep/Glob) when working with C# code.**1112## When to Use Sharpitect Tools1314Use Sharpitect tools as your **first choice** for:1516### Finding Declarations17- **Instead of**: `Grep` with pattern matching18- **Use**: `search_declarations` to find classes, interfaces, methods, properties by name19- **Benefits**: Exact semantic matches, understands C# syntax, filters by declaration kind2021### Understanding Type Hierarchies22- **Instead of**: Reading class files and searching for base classes23- **Use**: `get_inheritance` with `direction: descendants` (implementations) or `ancestors` (base types)24- **Benefits**: Complete hierarchy tree, includes interfaces and abstract classes2526### Finding Method/Property Usage27- **Instead of**: `Grep` for method names (which may match strings, comments, etc.)28- **Use**: `get_callers` to find what calls a method, or `get_usages` for all references29- **Benefits**: Accurate call sites only, no false positives from comments or strings3031### Understanding Dependencies32- **Instead of**: Reading code to find what a method calls33- **Use**: `get_callees` to see all methods/properties a method uses34- **Benefits**: Complete dependency graph, includes transitive calls3536### Exploring Code Structure37- **Instead of**: `Glob` to list files and `Read` to understand structure38- **Use**: `get_tree` to see containment hierarchy, `get_children` for members39- **Benefits**: Semantic structure, filtered by kind, shows relationships4041### Finding Project Dependencies42- **Instead of**: Reading .csproj files or searching for using statements43- **Use**: `get_dependencies` (what a project references) or `get_dependents` (what depends on a project)44- **Benefits**: Complete project graph, includes transitive dependencies4546## Tool Selection Guide4748### Use Sharpitect MCP tools for:491. **Finding C# elements**: Classes, methods, properties, interfaces502. **Understanding relationships**: Inheritance, calls, dependencies, usages513. **Navigating structure**: Hierarchies, containment, project organization524. **Precise queries**: "Find all implementations of IFoo"5354### Fall back to generic tools only when:551. **Reading source code**: Use `Read` to see actual implementation562. **Searching non-code content**: Comments, strings, XML docs, config files573. **Cross-language search**: JavaScript, JSON, Markdown files584. **Pattern matching**: Complex regex patterns not supported by Sharpitect5960## Common Workflows6162### Workflow 1: "Find implementations of an interface"63```641. search_declarations(query="IGraphRepository", kind="interface")652. get_inheritance(id="...", direction="descendants")66```6768### Workflow 2: "Where is this method called?"69```701. search_declarations(query="LoadGraph", kind="method")712. get_callers(id="...", depth=1)72```7374### Workflow 3: "What does this class depend on?"75```761. search_declarations(query="SqliteGraphRepository", kind="class")772. get_relationships(id="...", relationshipKind="uses", direction="outgoing")78```7980### Workflow 4: "Show me all classes in a namespace"81```821. search_declarations(query="Sharpitect.Analysis.Graph", kind="namespace")832. get_children(id="...", kind="class")84```8586### Workflow 5: "Find all methods that call a specific method"87```881. search_declarations(query="SaveNode", kind="method")892. get_usages(id="...", usageKind="call")90```9192## Key Sharpitect Tools Reference9394| Tool | Purpose | When to Use |95|------|---------|-------------|96| `search_declarations` | Find declarations by name | First step for finding any C# element |97| `get_inheritance` | Get type hierarchy | Understanding class/interface relationships |98| `get_callers` | Find who calls a method | Tracing method usage upstream |99| `get_callees` | Find what a method calls | Understanding method dependencies |100| `get_usages` | Find all references | Comprehensive usage analysis |101| `get_relationships` | Get all relationships | Exploring complex relationships |102| `get_dependencies` | Project dependencies | Understanding project references |103| `get_tree` | Containment hierarchy | Exploring code structure |104| `get_signature` | Type/method signature | Getting detailed type information |105| `get_file_declarations` | Declarations in a file | Quick overview of file contents |106107## Important Notes108109- **Always use Sharpitect first**: Even if you think Grep might work, try Sharpitect first110- **Combine with Read**: Use Sharpitect to find locations, then `Read` to see implementation111- **Be specific with kinds**: Use `kind` parameter to filter (class, interface, method, property, etc.)112- **Use depth wisely**: For `get_callers`/`get_callees`, start with depth=1, increase if needed113- **Check the database**: If Sharpitect returns no results, the codebase may not be analyzed yet (run `sharpitect analyze`)114115## Examples116117### ❌ Don't do this:118```119Grep pattern="class.*IGraphRepository" to find implementations120```121122### ✅ Do this instead:123```1241. search_declarations(query="IGraphRepository", kind="interface", matchMode="exact")1252. get_inheritance(id="...", direction="descendants")126```127128---129130### ❌ Don't do this:131```132Grep pattern="LoadGraph\\(" to find method calls133```134135### ✅ Do this instead:136```1371. search_declarations(query="LoadGraph", kind="method")1382. get_callers(id="...")139```140141---142143### ❌ Don't do this:144```145Read all files in a namespace to understand structure146```147148### ✅ Do this instead:149```1501. search_declarations(query="Sharpitect.Analysis", kind="namespace")1512. get_tree(rootId="...", maxDepth=2)152```153154## Summary155156**When working with C# code, think "Sharpitect first, generic tools second."** Sharpitect understands C# semantics and provides accurate, efficient navigation. Only fall back to Grep/Glob/Read when you need non-semantic searches or actual source code content.157158---159> Converted and distributed by [TomeVault](https://tomevault.io/claim/nick-boey) — claim your Tome and manage your conversions.160<!-- tomevault:4.0:skill_md:2026-04-13 -->