Class: VectorMCP::Middleware::Base
- Inherits:
-
Object
- Object
- VectorMCP::Middleware::Base
- Defined in:
- lib/vector_mcp/middleware/base.rb
Overview
Base class for all middleware implementations Provides common functionality and hook method templates
Instance Method Summary collapse
-
#after_auth(context) ⇒ Object
Called after successful authentication.
-
#after_prompt_get(context) ⇒ Object
Called after successful prompt get.
-
#after_resource_read(context) ⇒ Object
Called after successful resource read.
-
#after_response(context) ⇒ Object
Called after successful response.
-
#after_sampling_response(context) ⇒ Object
Called after successful sampling response.
-
#after_tool_call(context) ⇒ Object
Called after successful tool execution.
-
#before_auth(context) ⇒ Object
Called before authentication.
-
#before_prompt_get(context) ⇒ Object
Called before prompt get.
-
#before_request(context) ⇒ Object
Called before any request processing.
-
#before_resource_read(context) ⇒ Object
Called before resource read.
-
#before_sampling_request(context) ⇒ Object
Called before sampling request.
-
#before_tool_call(context) ⇒ Object
Called before tool execution.
-
#call(hook_type, context) ⇒ Object
Generic hook dispatcher - override specific hook methods instead.
-
#initialize(config = {}) ⇒ Base
constructor
Initialize middleware with optional configuration.
-
#on_auth_error(context) ⇒ Object
Called when authentication fails.
-
#on_prompt_error(context) ⇒ Object
Called when prompt get fails.
-
#on_resource_error(context) ⇒ Object
Called when resource read fails.
-
#on_sampling_error(context) ⇒ Object
Called when sampling fails.
-
#on_tool_error(context) ⇒ Object
Called when tool execution fails.
-
#on_transport_error(context) ⇒ Object
Called when transport error occurs.
Constructor Details
#initialize(config = {}) ⇒ Base
Initialize middleware with optional configuration
10 11 12 13 |
# File 'lib/vector_mcp/middleware/base.rb', line 10 def initialize(config = {}) @config = config @logger = VectorMCP.logger_for("middleware.#{self.class.name.split("::").last.downcase}") end |
Instance Method Details
#after_auth(context) ⇒ Object
Called after successful authentication
132 133 134 |
# File 'lib/vector_mcp/middleware/base.rb', line 132 def after_auth(context) # Override in subclasses end |
#after_prompt_get(context) ⇒ Object
Called after successful prompt get
72 73 74 |
# File 'lib/vector_mcp/middleware/base.rb', line 72 def after_prompt_get(context) # Override in subclasses end |
#after_resource_read(context) ⇒ Object
Called after successful resource read
52 53 54 |
# File 'lib/vector_mcp/middleware/base.rb', line 52 def after_resource_read(context) # Override in subclasses end |
#after_response(context) ⇒ Object
Called after successful response
112 113 114 |
# File 'lib/vector_mcp/middleware/base.rb', line 112 def after_response(context) # Override in subclasses end |
#after_sampling_response(context) ⇒ Object
Called after successful sampling response
92 93 94 |
# File 'lib/vector_mcp/middleware/base.rb', line 92 def after_sampling_response(context) # Override in subclasses end |
#after_tool_call(context) ⇒ Object
Called after successful tool execution
32 33 34 |
# File 'lib/vector_mcp/middleware/base.rb', line 32 def after_tool_call(context) # Override in subclasses end |
#before_auth(context) ⇒ Object
Called before authentication
126 127 128 |
# File 'lib/vector_mcp/middleware/base.rb', line 126 def before_auth(context) # Override in subclasses end |
#before_prompt_get(context) ⇒ Object
Called before prompt get
66 67 68 |
# File 'lib/vector_mcp/middleware/base.rb', line 66 def before_prompt_get(context) # Override in subclasses end |
#before_request(context) ⇒ Object
Called before any request processing
106 107 108 |
# File 'lib/vector_mcp/middleware/base.rb', line 106 def before_request(context) # Override in subclasses end |
#before_resource_read(context) ⇒ Object
Called before resource read
46 47 48 |
# File 'lib/vector_mcp/middleware/base.rb', line 46 def before_resource_read(context) # Override in subclasses end |
#before_sampling_request(context) ⇒ Object
Called before sampling request
86 87 88 |
# File 'lib/vector_mcp/middleware/base.rb', line 86 def before_sampling_request(context) # Override in subclasses end |
#before_tool_call(context) ⇒ Object
Called before tool execution
26 27 28 |
# File 'lib/vector_mcp/middleware/base.rb', line 26 def before_tool_call(context) # Override in subclasses end |
#call(hook_type, context) ⇒ Object
Generic hook dispatcher - override specific hook methods instead
18 19 20 |
# File 'lib/vector_mcp/middleware/base.rb', line 18 def call(hook_type, context) # Generic middleware hook execution end |
#on_auth_error(context) ⇒ Object
Called when authentication fails
138 139 140 |
# File 'lib/vector_mcp/middleware/base.rb', line 138 def on_auth_error(context) # Override in subclasses end |
#on_prompt_error(context) ⇒ Object
Called when prompt get fails
78 79 80 |
# File 'lib/vector_mcp/middleware/base.rb', line 78 def on_prompt_error(context) # Override in subclasses end |
#on_resource_error(context) ⇒ Object
Called when resource read fails
58 59 60 |
# File 'lib/vector_mcp/middleware/base.rb', line 58 def on_resource_error(context) # Override in subclasses end |
#on_sampling_error(context) ⇒ Object
Called when sampling fails
98 99 100 |
# File 'lib/vector_mcp/middleware/base.rb', line 98 def on_sampling_error(context) # Override in subclasses end |
#on_tool_error(context) ⇒ Object
Called when tool execution fails
38 39 40 |
# File 'lib/vector_mcp/middleware/base.rb', line 38 def on_tool_error(context) # Override in subclasses end |
#on_transport_error(context) ⇒ Object
Called when transport error occurs
118 119 120 |
# File 'lib/vector_mcp/middleware/base.rb', line 118 def on_transport_error(context) # Override in subclasses end |