Class: Textus::Contract::Spec
- Inherits:
-
Data
- Object
- Data
- Textus::Contract::Spec
- Defined in:
- lib/textus/contract.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
-
#surfaces ⇒ Object
readonly
Returns the value of attribute surfaces.
-
#verb ⇒ Object
readonly
Returns the value of attribute verb.
Instance Method Summary collapse
-
#input_schema ⇒ Object
JSON-Schema object for MCP tools/list inputSchema.
- #mcp? ⇒ Boolean
- #required_args ⇒ Object
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args
29 30 31 |
# File 'lib/textus/contract.rb', line 29 def args @args end |
#response ⇒ Object (readonly)
Returns the value of attribute response
29 30 31 |
# File 'lib/textus/contract.rb', line 29 def response @response end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary
29 30 31 |
# File 'lib/textus/contract.rb', line 29 def summary @summary end |
#surfaces ⇒ Object (readonly)
Returns the value of attribute surfaces
29 30 31 |
# File 'lib/textus/contract.rb', line 29 def surfaces @surfaces end |
#verb ⇒ Object (readonly)
Returns the value of attribute verb
29 30 31 |
# File 'lib/textus/contract.rb', line 29 def verb @verb end |
Instance Method Details
#input_schema ⇒ Object
JSON-Schema object for MCP tools/list inputSchema. Outer keys (:type, :properties, :required) are symbols; inner property keys are strings — matches the MCP/JSON wire shape expected by clients.
37 38 39 40 41 42 43 44 |
# File 'lib/textus/contract.rb', line 37 def input_schema props = args.to_h do |a| h = { "type" => Contract.json_type(a.type) } h["description"] = a.description if a.description [a.wire.to_s, h] end { type: "object", properties: props, required: required_args.map { |a| a.wire.to_s } } end |
#mcp? ⇒ Boolean
30 |
# File 'lib/textus/contract.rb', line 30 def mcp? = surfaces.include?(:mcp) |
#required_args ⇒ Object
32 |
# File 'lib/textus/contract.rb', line 32 def required_args = args.select(&:required) |