Class: RosettAi::Mcp::Tools::SchemaGetTool
- Inherits:
-
Object
- Object
- RosettAi::Mcp::Tools::SchemaGetTool
- Defined in:
- lib/rosett_ai/mcp/tools/schema_get_tool.rb
Overview
MCP tool: retrieve JSON Schema content for validation.
Returns the raw JSON Schema used for validating behaviour, design, or tooling configuration files. Read-only.
Constant Summary collapse
- TOOL_NAME =
'rai_schema_get'- DESCRIPTION =
'Get JSON Schema content for behaviour/design/tooling validation'- ANNOTATIONS =
{ 'readOnlyHint' => true, 'destructiveHint' => false, 'idempotentHint' => true, 'openWorldHint' => false }.freeze
- VALID_SCHEMAS =
{ 'behaviour' => 'behaviour_schema.json', 'design' => 'design_schema.json', 'tooling' => 'tooling_schema.json', 'workflow' => 'workflow_schema.json', 'provenance' => 'provenance_schema.json', 'policy' => 'policy_schema.json' }.freeze
Instance Method Summary collapse
-
#call(schema_name:) ⇒ Hash
Retrieves the JSON Schema content.
Instance Method Details
#call(schema_name:) ⇒ Hash
Retrieves the JSON Schema content.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/rosett_ai/mcp/tools/schema_get_tool.rb', line 43 def call(schema_name:) filename = VALID_SCHEMAS[schema_name] return invalid_schema_response(schema_name) unless filename schema_path = RosettAi.root.join('conf', 'schemas', filename) return missing_schema_response(schema_path) unless schema_path.exist? content = JSON.parse(schema_path.read) { schema_name: schema_name, filename: filename, content: content, path: schema_path.to_s } rescue JSON::ParserError => e ResponseHelper.error("Schema parse error: #{e.}") rescue StandardError => e ResponseHelper.error("Schema get failed: #{e.}") end |