Class: RosettAi::Mcp::Tools::ProvenanceTool

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

Overview

MCP tool: query AI provenance information.

Validates, shows, and logs provenance entries. Read-only operation.

Author:

  • hugo

  • claude

Constant Summary collapse

TOOL_NAME =
'rai_provenance'
DESCRIPTION =
'Query AI provenance (validate, show, log)'
ANNOTATIONS =
{
  'readOnlyHint' => true,
  'destructiveHint' => false,
  'idempotentHint' => true,
  'openWorldHint' => false
}.freeze
VALID_ACTIONS =
['validate', 'show', 'log'].freeze

Instance Method Summary collapse

Instance Method Details

#call(action: 'log', commit: nil, file: nil, role: nil) ⇒ Hash

Executes the provenance query.

Parameters:

  • action (String) (defaults to: 'log')

    one of 'validate', 'show', 'log'

  • commit (String, nil) (defaults to: nil)

    commit SHA for show action

  • file (String, nil) (defaults to: nil)

    file path filter

  • role (String, nil) (defaults to: nil)

    AI role filter for log

Returns:

  • (Hash)

    provenance information



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rosett_ai/mcp/tools/provenance_tool.rb', line 36

def call(action: 'log', commit: nil, file: nil, role: nil)
  return ResponseHelper.error("Invalid action: #{action}") unless VALID_ACTIONS.include?(action)

  tracker = RosettAi::Provenance::Tracker.new
  case action
  when 'validate' then action_validate(tracker)
  when 'show' then action_show(tracker, commit: commit, file: file)
  when 'log' then action_log(tracker, role: role)
  end
rescue StandardError => e
  ResponseHelper.error("Provenance #{action} failed: #{e.message}")
end