Class: SampleTool

Inherits:
ApplicationTool show all
Defined in:
lib/mcp_on_ruby/generators/templates/sample_tool.rb

Overview

Sample tool demonstrating MCP tool creation

Instance Attribute Summary

Attributes inherited from McpOnRuby::Tool

#description, #input_schema, #metadata, #name, #tags

Instance Method Summary collapse

Methods inherited from McpOnRuby::Tool

#authorized?, #call, #to_schema

Constructor Details

#initializeSampleTool

Returns a new instance of SampleTool.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/mcp_on_ruby/generators/templates/sample_tool.rb', line 5

def initialize
  super(
    name: 'sample_tool',
    description: 'A sample tool that demonstrates basic functionality',
    input_schema: {
      type: 'object',
      properties: {
        message: {
          type: 'string',
          description: 'Message to process'
        },
        count: {
          type: 'integer',
          description: 'Number of times to repeat',
          minimum: 1,
          maximum: 10,
          default: 1
        }
      },
      required: ['message']
    },
    metadata: {
      category: 'sample',
      version: '1.0.0'
    },
    tags: ['sample', 'demo']
  )
end