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
22 23 24 |
# File 'lib/textus/contract.rb', line 22 def args @args end |
#response ⇒ Object (readonly)
Returns the value of attribute response
22 23 24 |
# File 'lib/textus/contract.rb', line 22 def response @response end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary
22 23 24 |
# File 'lib/textus/contract.rb', line 22 def summary @summary end |
#surfaces ⇒ Object (readonly)
Returns the value of attribute surfaces
22 23 24 |
# File 'lib/textus/contract.rb', line 22 def surfaces @surfaces end |
#verb ⇒ Object (readonly)
Returns the value of attribute verb
22 23 24 |
# File 'lib/textus/contract.rb', line 22 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.
30 31 32 33 34 35 36 37 |
# File 'lib/textus/contract.rb', line 30 def input_schema props = args.to_h do |a| h = { "type" => Contract.json_type(a.type) } h["description"] = a.description if a.description [a.name.to_s, h] end { type: "object", properties: props, required: required_args.map { |a| a.name.to_s } } end |
#mcp? ⇒ Boolean
23 |
# File 'lib/textus/contract.rb', line 23 def mcp? = surfaces.include?(:mcp) |
#required_args ⇒ Object
25 |
# File 'lib/textus/contract.rb', line 25 def required_args = args.select(&:required) |