Documentation
¶
Index ¶
- Constants
- Variables
- func NewControlCatalogHandler(fetchLexicon LexiconFetcher, fetchSchemaDocs SchemaDocsFetcher) mcp.PromptHandler
- func NewMigrationHandler(fetchLexicon LexiconFetcher, fetchSchemaDocs SchemaDocsFetcher) mcp.PromptHandler
- func NewThreatAssessmentHandler(fetchLexicon LexiconFetcher, fetchSchemaDocs SchemaDocsFetcher) mcp.PromptHandler
- type AdvisoryMode
- type ArtifactMode
- type InputMigrateGemaraArtifact
- type InputValidateGemaraArtifact
- type LexiconFetcher
- type MigratedArtifact
- type Mode
- type OutputMigrateGemaraArtifact
- type OutputValidateGemaraArtifact
- type SchemaDocsFetcher
Constants ¶
const ( LexiconResourceURI = "gemara://lexicon" SchemaDocsResourceURI = "gemara://schema/definitions" SchemaDocsResourceURITemplate = "gemara://schema/definitions{?version}" )
Variables ¶
var DefaultGemaraVersion = gemara.SchemaVersion
DefaultGemaraVersion is derived from the go-gemara SDK's supported schema version.
var EmbeddedLexicon string
var MetadataMigrateGemaraArtifact = &mcp.Tool{ Name: "migrate_gemara_artifact", Description: "Migrate a Gemara artifact to v1 schema using CUE transformations. When the artifact is missing metadata fields (common in older v0 artifacts), use artifact_type and gemara_version to supply them.", InputSchema: map[string]interface{}{ "type": "object", "required": []string{"artifact_content"}, "properties": map[string]interface{}{ "artifact_content": map[string]interface{}{ "type": "string", "description": "YAML content of the Gemara artifact to migrate", }, "artifact_type": map[string]interface{}{ "type": "string", "description": "Artifact type when metadata.type is missing. Infer from structure: threats → ThreatCatalog, controls → ControlCatalog.", "enum": []string{gemara.ThreatCatalogArtifact.String(), gemara.ControlCatalogArtifact.String()}, }, "gemara_version": map[string]interface{}{ "type": "string", "description": "Source gemara-version when metadata.gemara-version is missing (e.g. \"0.20.0\").", }, }, }, }
MetadataMigrateGemaraArtifact describes the MigrateGemaraArtifact tool.
var MetadataValidateGemaraArtifact = &mcp.Tool{ Name: "validate_gemara_artifact", Description: "Validate a Gemara artifact YAML content against the Gemara CUE schema using the CUE registry module.", InputSchema: map[string]interface{}{ "type": "object", "required": []string{"artifact_content", "definition"}, "properties": map[string]interface{}{ "artifact_content": map[string]interface{}{ "type": "string", "description": "YAML content of the Gemara artifact to validate", }, "definition": map[string]interface{}{ "type": "string", "description": "CUE definition name to validate against (e.g., '#ControlCatalog', '#GuidanceCatalog', '#Policy', '#EvaluationLog')", }, "version": map[string]interface{}{ "type": "string", "description": "Version of the Gemara module to validate against (default: 'latest')", }, }, }, }
MetadataValidateGemaraArtifact describes the ValidateGemaraArtifact tool.
var PromptControlCatalog = &mcp.Prompt{ Name: "control_catalog", Title: "Control Catalog Wizard", Description: "Interactive wizard that guides you through creating a Gemara-compatible Control Catalog (Layer 2) for your project.", Arguments: []*mcp.PromptArgument{ { Name: "component", Title: "Component Name", Description: "The name of the component or technology to create controls for (e.g., 'container runtime', 'API gateway', 'object storage')", Required: true, }, { Name: "id_prefix", Title: "ID Prefix", Description: "Organization and project prefix for identifiers in ORG.PROJECT.COMPONENT format (e.g., 'ACME.PLAT.GW')", Required: true, }, }, }
PromptControlCatalog is the MCP prompt definition for the control catalog wizard.
var PromptMigration = &mcp.Prompt{ Name: "migration", Title: "Schema Migration Wizard", Description: "Interactive wizard that guides you through migrating Gemara artifacts from v0 to v1 schema, including CapabilityCatalog extraction from ThreatCatalog.", Arguments: []*mcp.PromptArgument{ { Name: "component", Title: "Component Name", Description: "The name of the component whose artifacts are being migrated (e.g., 'container runtime', 'API gateway')", Required: true, }, }, }
PromptMigration is the MCP prompt definition for the schema migration wizard.
var PromptThreatAssessment = &mcp.Prompt{ Name: "threat_assessment", Title: "Threat Assessment Wizard", Description: "Interactive wizard that guides you through creating a Gemara-compatible Threat Catalog (Layer 2) for your project.", Arguments: []*mcp.PromptArgument{ { Name: "component", Title: "Component Name", Description: "The name of the component or technology to assess (e.g., 'container runtime', 'API gateway', 'object storage')", Required: true, }, { Name: "id_prefix", Title: "ID Prefix", Description: "Organization and project prefix for identifiers in ORG.PROJECT.COMPONENT format (e.g., 'ACME.PLAT.GW')", Required: true, }, }, }
PromptThreatAssessment is the MCP prompt definition for the threat assessment wizard.
var ResourceLexicon = &mcp.Resource{ URI: LexiconResourceURI, Name: "gemara-lexicon", Title: "Gemara Lexicon", Description: "Term definitions for the Gemara security model.", MIMEType: "text/yaml", }
var ResourceSchemaDocs = &mcp.Resource{ URI: SchemaDocsResourceURI, Name: "gemara-schema-docs", Title: "Gemara Schema Documentation", Description: "CUE schema definitions for all Gemara artifact types (latest version). Use the versioned resource template for a specific version.", MIMEType: "text/plain", }
var ResourceSchemaDocsTemplate = &mcp.ResourceTemplate{ URITemplate: SchemaDocsResourceURITemplate, Name: "gemara-schema-docs-versioned", Title: "Gemara Schema Documentation (versioned)", Description: "CUE schema definitions for a specific Gemara module version. Accepts a semver version parameter (e.g., v1.2.3) or 'latest'.", MIMEType: "text/plain", }
Functions ¶
func NewControlCatalogHandler ¶
func NewControlCatalogHandler(fetchLexicon LexiconFetcher, fetchSchemaDocs SchemaDocsFetcher) mcp.PromptHandler
NewControlCatalogHandler returns a PromptHandler that embeds the lexicon and schema docs as EmbeddedResource messages, guaranteeing the LLM receives both during the wizard.
func NewMigrationHandler ¶
func NewMigrationHandler(fetchLexicon LexiconFetcher, fetchSchemaDocs SchemaDocsFetcher) mcp.PromptHandler
NewMigrationHandler returns a PromptHandler for the v0→v1 schema migration wizard.
func NewThreatAssessmentHandler ¶
func NewThreatAssessmentHandler(fetchLexicon LexiconFetcher, fetchSchemaDocs SchemaDocsFetcher) mcp.PromptHandler
NewThreatAssessmentHandler returns a PromptHandler that embeds the lexicon and schema docs as EmbeddedResource messages, guaranteeing the LLM receives both during the wizard.
Types ¶
type AdvisoryMode ¶
type AdvisoryMode struct {
// contains filtered or unexported fields
}
AdvisoryMode defines tools and resources for operating in a read-only query mode
func NewAdvisoryMode ¶
func NewAdvisoryMode(cacheTTL time.Duration) (*AdvisoryMode, error)
NewAdvisoryMode creates a new AdvisoryMode with the provided cache TTL.
func (*AdvisoryMode) Description ¶
func (a *AdvisoryMode) Description() string
func (*AdvisoryMode) Name ¶
func (a *AdvisoryMode) Name() string
func (*AdvisoryMode) Register ¶
func (a *AdvisoryMode) Register(server *mcp.Server)
type ArtifactMode ¶
type ArtifactMode struct {
*AdvisoryMode
}
ArtifactMode extends AdvisoryMode with guided wizards for creating Gemara artifacts.
func NewArtifactMode ¶
func NewArtifactMode(cacheTTL time.Duration) (*ArtifactMode, error)
NewArtifactMode creates a new ArtifactMode with all AdvisoryMode capabilities plus artifact prompts.
func (*ArtifactMode) Description ¶
func (a *ArtifactMode) Description() string
func (*ArtifactMode) Name ¶
func (a *ArtifactMode) Name() string
func (*ArtifactMode) Register ¶
func (a *ArtifactMode) Register(server *mcp.Server)
type InputMigrateGemaraArtifact ¶
type InputMigrateGemaraArtifact struct {
ArtifactContent string `json:"artifact_content"`
ArtifactType string `json:"artifact_type"`
GemaraVersion string `json:"gemara_version"`
}
InputMigrateGemaraArtifact is the input for the MigrateGemaraArtifact tool.
type InputValidateGemaraArtifact ¶
type InputValidateGemaraArtifact struct {
ArtifactContent string `json:"artifact_content"`
Definition string `json:"definition"`
Version string `json:"version"`
}
InputValidateGemaraArtifact is the input for the ValidateGemaraArtifact tool.
type LexiconFetcher ¶
LexiconFetcher retrieves the lexicon content and its source at prompt invocation time. Source is "embedded" when the remote fetch failed and the built-in copy was used.
type MigratedArtifact ¶
type MigratedArtifact struct {
Type string `json:"type"`
SuggestedFilename string `json:"suggested_filename"`
Content string `json:"content"`
}
MigratedArtifact represents a single output artifact from the migration.
type Mode ¶
type Mode interface {
// Name returns the string representation of the mode.
Name() string
// Description returns a human-readable description of the mode.
Description() string
// Register adds mode-related tools and resources to the mcp server
Register(*mcp.Server)
}
Mode represents the operational mode of the MCP server.
type OutputMigrateGemaraArtifact ¶
type OutputMigrateGemaraArtifact struct {
Artifacts []MigratedArtifact `json:"artifacts,omitempty"`
Changes []string `json:"changes"`
Message string `json:"message"`
}
OutputMigrateGemaraArtifact is the output for the MigrateGemaraArtifact tool.
func MigrateGemaraArtifact ¶
func MigrateGemaraArtifact(_ context.Context, _ *mcp.CallToolRequest, input InputMigrateGemaraArtifact) (*mcp.CallToolResult, OutputMigrateGemaraArtifact, error)
MigrateGemaraArtifact migrates a Gemara artifact to v1 schema using the pattern - YAML → CUE transformation → YAML.
type OutputValidateGemaraArtifact ¶
type OutputValidateGemaraArtifact struct {
Valid bool `json:"valid"`
Errors []string `json:"errors,omitempty"`
Message string `json:"message"`
}
OutputValidateGemaraArtifact is the output for the ValidateGemaraArtifact tool.
func ValidateGemaraArtifact ¶
func ValidateGemaraArtifact(ctx context.Context, _ *mcp.CallToolRequest, input InputValidateGemaraArtifact, cf *fetcher.CachedFetcher[cue.Value]) (*mcp.CallToolResult, OutputValidateGemaraArtifact, error)
ValidateGemaraArtifact validates a Gemara artifact using the CUE Go SDK with the registry module. The returned *mcp.CallToolResult is always nil; the go-sdk derives the tool response from the OutputValidateGemaraArtifact struct.