Class: RosettAi::Mcp::Tools::DesignShowTool

Inherits:
Object
  • Object
show all
Defined in:
lib/rosett_ai/mcp/tools/design_show_tool.rb

Overview

MCP tool: show a specific design document.

Returns the full content and metadata of a named design document. Read-only operation.

Author:

  • hugo

  • claude

Constant Summary collapse

TOOL_NAME =
'rai_design_show'
DESCRIPTION =
'Show details of a specific rai design document'
ANNOTATIONS =
{
  'readOnlyHint' => true,
  'destructiveHint' => false,
  'idempotentHint' => true,
  'openWorldHint' => false
}.freeze

Instance Method Summary collapse

Instance Method Details

#call(name:, full: false) ⇒ Hash

Executes the show operation.

Parameters:

  • name (String)

    design document name (without .yml)

  • full (Boolean) (defaults to: false)

    include acceptance criteria

Returns:

  • (Hash)

    design data or error



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/rosett_ai/mcp/tools/design_show_tool.rb', line 32

def call(name:, full: false)
  path = RosettAi.root.join('conf', 'design', "#{name}.yml")
  return ResponseHelper.error("Design document not found: #{name}") unless path.exist?

  data = YAML.safe_load_file(path, permitted_classes: [Symbol])
  result = {
    name: data['name'],
    description: data['description'],
    status: data['status'],
    priority: data['priority'],
    domain: data['domain'],
    version: data['version'],
    file: path.basename.to_s
  }
  result[:acceptance_criteria] = Array(data['acceptance_criteria']) if full
  result
rescue Psych::SyntaxError => e
  ResponseHelper.error("YAML parse error in #{name}: #{e.message}")
end