Module: VectorMCP::Server::Capabilities

Included in:
VectorMCP::Server
Defined in:
lib/vector_mcp/server/capabilities.rb

Overview

Handles server capabilities and configuration

Instance Method Summary collapse

Instance Method Details

#clear_prompts_list_changedvoid

This method returns an undefined value.

Resets the ‘prompts_list_changed` flag to false.



35
36
37
# File 'lib/vector_mcp/server/capabilities.rb', line 35

def clear_prompts_list_changed
  @prompts_list_changed = false
end

#clear_roots_list_changedvoid

This method returns an undefined value.

Resets the ‘roots_list_changed` flag to false.



47
48
49
# File 'lib/vector_mcp/server/capabilities.rb', line 47

def clear_roots_list_changed
  @roots_list_changed = false
end

#notify_prompts_list_changedvoid

This method returns an undefined value.

Notifies connected clients that the list of available prompts has changed.



41
42
43
# File 'lib/vector_mcp/server/capabilities.rb', line 41

def notify_prompts_list_changed
  send_list_changed_notification("prompts") if @prompts_list_changed
end

#notify_roots_list_changedvoid

This method returns an undefined value.

Notifies connected clients that the list of available roots has changed.



53
54
55
# File 'lib/vector_mcp/server/capabilities.rb', line 53

def notify_roots_list_changed
  send_list_changed_notification("roots") if @roots_list_changed
end

#sampling_configHash

Returns the sampling configuration for this server.

Returns:

  • (Hash)

    The sampling configuration including capabilities and limits.



17
18
19
# File 'lib/vector_mcp/server/capabilities.rb', line 17

def sampling_config
  @sampling_config[:config]
end

#server_capabilitiesHash

Describes the capabilities of this server according to MCP specifications.

Returns:

  • (Hash)

    A capabilities object.



23
24
25
26
27
28
29
30
31
# File 'lib/vector_mcp/server/capabilities.rb', line 23

def server_capabilities
  caps = {}
  caps[:tools] = { listChanged: false } unless @tools.empty?
  caps[:resources] = { subscribe: false, listChanged: false } unless @resources.empty?
  caps[:prompts] = { listChanged: @prompts_list_changed } unless @prompts.empty?
  caps[:roots] = { listChanged: true } unless @roots.empty?
  caps[:sampling] = @sampling_config[:capabilities]
  caps
end

#server_infoHash

Provides basic information about the server.

Returns:

  • (Hash)

    Server name and version.



11
12
13
# File 'lib/vector_mcp/server/capabilities.rb', line 11

def server_info
  { name: @name, version: @version }
end

#subscribe_prompts(session) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Registers a session as a subscriber to prompt list changes.



59
60
61
62
# File 'lib/vector_mcp/server/capabilities.rb', line 59

def subscribe_prompts(session)
  @prompt_subscribers << session unless @prompt_subscribers.include?(session)
  # Session subscribed to prompt list changes
end