MCPcopy Create free account
hub / github.com/IBM/mcp-cli / create_mock_tools

Function create_mock_tools

examples/tools/demo_tool_execution.py:26–87  ·  view source on GitHub ↗

Create some mock tools for demonstration.

()

Source from the content-addressed store, hash-verified

24
25# Create mock tools for demonstration
26def create_mock_tools():
27 """Create some mock tools for demonstration."""
28 tools = []
29
30 # Echo tool
31 echo_tool = Mock()
32 echo_tool.name = "echo"
33 echo_tool.description = "Echoes back the provided message"
34 echo_tool.inputSchema = {
35 "type": "object",
36 "properties": {
37 "message": {"type": "string", "description": "The message to echo back"}
38 },
39 "required": ["message"],
40 }
41 tools.append(echo_tool)
42
43 # Calculator tool
44 calc_tool = Mock()
45 calc_tool.name = "calculate"
46 calc_tool.description = "Performs basic math operations"
47 calc_tool.inputSchema = {
48 "type": "object",
49 "properties": {
50 "operation": {
51 "type": "string",
52 "description": "The operation to perform (add, subtract, multiply, divide)",
53 "enum": ["add", "subtract", "multiply", "divide"],
54 },
55 "a": {"type": "number", "description": "First number"},
56 "b": {"type": "number", "description": "Second number"},
57 },
58 "required": ["operation", "a", "b"],
59 }
60 tools.append(calc_tool)
61
62 # Database query tool
63 db_tool = Mock()
64 db_tool.name = "query_database"
65 db_tool.description = "Execute SQL queries on the database"
66 db_tool.inputSchema = {
67 "type": "object",
68 "properties": {
69 "sql": {"type": "string", "description": "SQL query to execute"},
70 "limit": {
71 "type": "number",
72 "description": "Maximum number of results to return",
73 "default": 10,
74 },
75 },
76 "required": ["sql"],
77 }
78 tools.append(db_tool)
79
80 # File reader tool (no parameters)
81 list_tool = Mock()
82 list_tool.name = "list_files"
83 list_tool.description = "List all available files"

Callers 1

demo_tool_executionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected