|
30 | 30 | client = helix.Client(local=True, port=6969) |
31 | 31 |
|
32 | 32 | @mcp.tool() |
33 | | -def init() -> str: return client.query(helix.init())[0] |
| 33 | +def call_tool() -> str: |
34 | 34 |
|
35 | | -@mcp.tool() |
36 | | -def next(connection_id: str) -> str: |
37 | | - return client.query(helix.next(connection_id))[0] |
38 | | - |
39 | | -@mcp.tool() |
40 | | -def collect(connection_id: str) -> str: |
41 | | - return client.query(helix.collect(connection_id))[0] |
42 | | - |
43 | | -@mcp.tool() |
44 | | -def call_tool(tool: str, args: dict={}) -> str: |
45 | | - response = client.query(tool, args) |
| 35 | + response = client.query("call_tool", {}) |
46 | 36 | return response[0] |
47 | 37 |
|
48 | 38 | @mcp.resource("config://{connection_id}/schema") |
@@ -78,80 +68,6 @@ def out_e_step(connection_id: str, edge_label: str) -> str: |
78 | 68 | print(f"res {response}", file=sys.stderr) |
79 | 69 | return response[0] |
80 | 70 |
|
81 | | -@mcp.tool() |
82 | | -def in_step(connection_id: str, edge_label: str, edge_type: str) -> str: |
83 | | - tool = "in_step" |
84 | | - args = { |
85 | | - "edge_label": edge_label, |
86 | | - "edge_type": edge_type, |
87 | | - } |
88 | | - |
89 | | - payload = { |
90 | | - "connection_id": connection_id, |
91 | | - "data": args, |
92 | | - } |
93 | | - response = client.query(helix.call_tool(tool, payload)) |
94 | | - print(f"res {response}", file=sys.stderr) |
95 | | - return response[0] |
96 | | - |
97 | | -@mcp.tool() |
98 | | -def in_e_step(connection_id: str, edge_label: str) -> str: |
99 | | - tool = "in_e_step" |
100 | | - args = { "edge_label": edge_label } |
101 | | - |
102 | | - payload = { |
103 | | - "connection_id": connection_id, |
104 | | - "data": args, |
105 | | - } |
106 | | - response = client.query(helix.call_tool(tool, payload)) |
107 | | - print(f"res {response}", file=sys.stderr) |
108 | | - return response[0] |
109 | | - |
110 | | -@mcp.tool() |
111 | | -def n_from_type(connection_id: str, node_type: str) -> str: |
112 | | - tool = "n_from_type" |
113 | | - args = { "node_type": node_type } |
114 | | - |
115 | | - payload = { |
116 | | - "connection_id": connection_id, |
117 | | - "data": args, |
118 | | - } |
119 | | - response = client.query(helix.call_tool(tool, payload)) |
120 | | - print(f"res {response}", file=sys.stderr) |
121 | | - return response[0] |
122 | | - |
123 | | -@mcp.tool() |
124 | | -def e_from_type(connection_id: str, edge_type: str) -> str: |
125 | | - tool = "e_from_type" |
126 | | - args = { "edge_type": edge_type } |
127 | | - |
128 | | - payload = { |
129 | | - "connection_id": connection_id, |
130 | | - "data": args, |
131 | | - } |
132 | | - response = client.query(helix.call_tool(tool, payload)) |
133 | | - print(f"res {response}", file=sys.stderr) |
134 | | - return response[0] |
135 | | - |
136 | | -@mcp.tool() |
137 | | -def filter_items( |
138 | | - connection_id: str, |
139 | | - properties: Optional[List[Tuple[str, str]]]=None, |
140 | | - filter_traversals: Optional[List[dict]]=None |
141 | | -) -> str: |
142 | | - tool = "filter_items" |
143 | | - args = {} |
144 | | - if properties: args["properties"] = properties |
145 | | - if filter_traversals: args["filter_traversals"] = filter_traversals |
146 | | - |
147 | | - payload = { |
148 | | - "connection_id": connection_id, |
149 | | - "data": args, |
150 | | - } |
151 | | - response = client.query(helix.call_tool(tool, payload)) |
152 | | - print(f"res {response}", file=sys.stderr) |
153 | | - return response[0] |
154 | | - |
155 | 71 | if __name__ == "__main__": |
156 | 72 | mcp.run(transport="http", host="127.0.0.1", port=8000) |
157 | 73 |
|
0 commit comments