Class: RosettAi::Mcp::Resources::ProvenanceResource

Inherits:
Object
  • Object
show all
Defined in:
lib/rosett_ai/mcp/resources/provenance_resource.rb

Overview

MCP resource provider for AI provenance log.

Exposes the full provenance log as an MCP resource.

Author:

  • hugo

  • claude

Constant Summary collapse

URI_PREFIX =
'rosett-ai://provenance/'
PROVENANCE_FILE =
'.ai-provenance.yml'

Instance Method Summary collapse

Instance Method Details

#listArray<Hash>

Lists available provenance resources.

Returns:

  • (Array<Hash>)

    resource entries



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rosett_ai/mcp/resources/provenance_resource.rb', line 22

def list
  path = RosettAi.root.join(PROVENANCE_FILE)
  return [] unless path.exist?

  [{
    uri: "#{URI_PREFIX}log",
    name: 'provenance-log',
    description: 'Full AI provenance log',
    mime_type: 'application/x-yaml'
  }]
end

#read(_name = 'log') ⇒ Hash?

Reads the provenance log.

Parameters:

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

    resource name (only 'log' supported)

Returns:

  • (Hash, nil)

    resource content



38
39
40
41
42
43
44
45
46
47
# File 'lib/rosett_ai/mcp/resources/provenance_resource.rb', line 38

def read(_name = 'log')
  path = RosettAi.root.join(PROVENANCE_FILE)
  return nil unless path.exist?

  {
    uri: "#{URI_PREFIX}log",
    content: File.read(path),
    mime_type: 'application/x-yaml'
  }
end