mirror of
https://github.com/syntrex-lab/gomcp.git
synced 2026-04-26 04:46:22 +02:00
- Rename Go module: sentinel-community/gomcp -> syntrex/gomcp (50+ files) - Rename npm package: sentinel-dashboard -> syntrex-dashboard - Update Cargo.toml repository URL to syntrex/syntrex - Update all doc references from DmitrL-dev/AISecurity to syntrex - Add root Makefile (build-all, test-all, lint-all, clean-all) - Add MIT LICENSE - Add .editorconfig (Go/Rust/TS/C cross-language) - Add .github/workflows/ci.yml (Go + Rust + Dashboard) - Add dashboard next.config.ts and .env.example - Clean ARCHITECTURE.md: remove brain/immune/strike/micro-swarm, fix 61->67 engines
48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
package tools
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/syntrex/gomcp/internal/domain/crystal"
|
|
)
|
|
|
|
// CrystalService implements MCP tool logic for code crystal operations.
|
|
type CrystalService struct {
|
|
store crystal.CrystalStore
|
|
}
|
|
|
|
// NewCrystalService creates a new CrystalService.
|
|
func NewCrystalService(store crystal.CrystalStore) *CrystalService {
|
|
return &CrystalService{store: store}
|
|
}
|
|
|
|
// GetCrystal retrieves a crystal by path.
|
|
func (s *CrystalService) GetCrystal(ctx context.Context, path string) (*crystal.Crystal, error) {
|
|
return s.store.Get(ctx, path)
|
|
}
|
|
|
|
// ListCrystals lists crystals matching a path pattern.
|
|
func (s *CrystalService) ListCrystals(ctx context.Context, pattern string, limit int) ([]*crystal.Crystal, error) {
|
|
if limit <= 0 {
|
|
limit = 50
|
|
}
|
|
return s.store.List(ctx, pattern, limit)
|
|
}
|
|
|
|
// SearchCrystals searches crystals by content/primitives.
|
|
func (s *CrystalService) SearchCrystals(ctx context.Context, query string, limit int) ([]*crystal.Crystal, error) {
|
|
if limit <= 0 {
|
|
limit = 20
|
|
}
|
|
return s.store.Search(ctx, query, limit)
|
|
}
|
|
|
|
// GetCrystalStats returns crystal store statistics.
|
|
func (s *CrystalService) GetCrystalStats(ctx context.Context) (*crystal.CrystalStats, error) {
|
|
return s.store.Stats(ctx)
|
|
}
|
|
|
|
// Store returns the underlying CrystalStore for direct access.
|
|
func (s *CrystalService) Store() crystal.CrystalStore {
|
|
return s.store
|
|
}
|