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 =

Returns MCP tool identifier string.

Returns:

  • (String)

    MCP tool identifier string.

'rai_design_show'
DESCRIPTION =

Returns Human-readable description of this tool.

Returns:

  • (String)

    Human-readable description of this tool.

'Show details of a specific rai design document'
ANNOTATIONS =

Returns MCP protocol annotations describing tool capabilities.

Returns:

  • (Hash)

    MCP protocol annotations describing tool capabilities.

{
  'readOnlyHint' => true,
  'destructiveHint' => false,
  'idempotentHint' => true,
  'openWorldHint' => false
}.freeze
INPUT_SCHEMA =

Returns JSON Schema defining the tool input parameters.

Returns:

  • (Hash)

    JSON Schema defining the tool input parameters.

{
  type: 'object',
  properties: {
    name: {
      type: 'string',
      description: 'Design document name'
    },
    full: {
      type: 'boolean',
      description: 'Include full content (default: false)'
    }
  },
  required: ['name']
}.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



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/rosett_ai/mcp/tools/design_show_tool.rb', line 51

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