mech-client 0.7.0__py3-none-any.whl → 0.8.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mech_client/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Mech client."""
2
2
 
3
- __version__ = "0.7.0"
3
+ __version__ = "0.8.1"
@@ -0,0 +1,185 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "internalType": "address",
6
+ "name": "_serviceRegistry",
7
+ "type": "address"
8
+ }
9
+ ],
10
+ "stateMutability": "nonpayable",
11
+ "type": "constructor"
12
+ },
13
+ {
14
+ "inputs": [],
15
+ "name": "ReentrancyGuard",
16
+ "type": "error"
17
+ },
18
+ {
19
+ "inputs": [
20
+ {
21
+ "internalType": "address",
22
+ "name": "account",
23
+ "type": "address"
24
+ }
25
+ ],
26
+ "name": "UnauthorizedAccount",
27
+ "type": "error"
28
+ },
29
+ {
30
+ "inputs": [],
31
+ "name": "ZeroAddress",
32
+ "type": "error"
33
+ },
34
+ {
35
+ "anonymous": false,
36
+ "inputs": [
37
+ {
38
+ "indexed": true,
39
+ "internalType": "uint256",
40
+ "name": "serviceId",
41
+ "type": "uint256"
42
+ },
43
+ {
44
+ "indexed": true,
45
+ "internalType": "bytes32",
46
+ "name": "hash",
47
+ "type": "bytes32"
48
+ }
49
+ ],
50
+ "name": "ComplementaryMetadataUpdated",
51
+ "type": "event"
52
+ },
53
+ {
54
+ "inputs": [],
55
+ "name": "CID_PREFIX",
56
+ "outputs": [
57
+ {
58
+ "internalType": "string",
59
+ "name": "",
60
+ "type": "string"
61
+ }
62
+ ],
63
+ "stateMutability": "view",
64
+ "type": "function"
65
+ },
66
+ {
67
+ "inputs": [],
68
+ "name": "VERSION",
69
+ "outputs": [
70
+ {
71
+ "internalType": "string",
72
+ "name": "",
73
+ "type": "string"
74
+ }
75
+ ],
76
+ "stateMutability": "view",
77
+ "type": "function"
78
+ },
79
+ {
80
+ "inputs": [],
81
+ "name": "baseURI",
82
+ "outputs": [
83
+ {
84
+ "internalType": "string",
85
+ "name": "",
86
+ "type": "string"
87
+ }
88
+ ],
89
+ "stateMutability": "view",
90
+ "type": "function"
91
+ },
92
+ {
93
+ "inputs": [
94
+ {
95
+ "internalType": "uint256",
96
+ "name": "serviceId",
97
+ "type": "uint256"
98
+ },
99
+ {
100
+ "internalType": "bytes32",
101
+ "name": "hash",
102
+ "type": "bytes32"
103
+ }
104
+ ],
105
+ "name": "changeHash",
106
+ "outputs": [],
107
+ "stateMutability": "nonpayable",
108
+ "type": "function"
109
+ },
110
+ {
111
+ "inputs": [
112
+ {
113
+ "internalType": "address",
114
+ "name": "account",
115
+ "type": "address"
116
+ },
117
+ {
118
+ "internalType": "uint256",
119
+ "name": "serviceId",
120
+ "type": "uint256"
121
+ }
122
+ ],
123
+ "name": "isAbleChangeHash",
124
+ "outputs": [
125
+ {
126
+ "internalType": "bool",
127
+ "name": "",
128
+ "type": "bool"
129
+ }
130
+ ],
131
+ "stateMutability": "view",
132
+ "type": "function"
133
+ },
134
+ {
135
+ "inputs": [
136
+ {
137
+ "internalType": "uint256",
138
+ "name": "",
139
+ "type": "uint256"
140
+ }
141
+ ],
142
+ "name": "mapServiceHashes",
143
+ "outputs": [
144
+ {
145
+ "internalType": "bytes32",
146
+ "name": "",
147
+ "type": "bytes32"
148
+ }
149
+ ],
150
+ "stateMutability": "view",
151
+ "type": "function"
152
+ },
153
+ {
154
+ "inputs": [],
155
+ "name": "serviceRegistry",
156
+ "outputs": [
157
+ {
158
+ "internalType": "address",
159
+ "name": "",
160
+ "type": "address"
161
+ }
162
+ ],
163
+ "stateMutability": "view",
164
+ "type": "function"
165
+ },
166
+ {
167
+ "inputs": [
168
+ {
169
+ "internalType": "uint256",
170
+ "name": "serviceId",
171
+ "type": "uint256"
172
+ }
173
+ ],
174
+ "name": "tokenURI",
175
+ "outputs": [
176
+ {
177
+ "internalType": "string",
178
+ "name": "",
179
+ "type": "string"
180
+ }
181
+ ],
182
+ "stateMutability": "view",
183
+ "type": "function"
184
+ }
185
+ ]
mech_client/cli.py CHANGED
@@ -31,6 +31,17 @@ from mech_client.interact import interact as interact_
31
31
  from mech_client.marketplace_interact import (
32
32
  marketplace_interact as marketplace_interact_,
33
33
  )
34
+ from mech_client.mech_marketplace_tool_management import (
35
+ extract_input_schema,
36
+ extract_output_schema,
37
+ )
38
+ from mech_client.mech_marketplace_tool_management import (
39
+ get_tool_description as get_tool_description_for_marketplace_mech,
40
+ )
41
+ from mech_client.mech_marketplace_tool_management import (
42
+ get_tool_io_schema as get_tool_io_schema_for_marketplace_mech,
43
+ )
44
+ from mech_client.mech_marketplace_tool_management import get_tools_for_marketplace_mech
34
45
  from mech_client.mech_tool_management import (
35
46
  get_tool_description,
36
47
  get_tool_io_schema,
@@ -353,6 +364,84 @@ def tool_io_schema(tool_id: str, chain_config: str) -> None:
353
364
  click.echo(f"Network or I/O error: {str(e)}")
354
365
 
355
366
 
367
+ @click.command(name="tools-for-marketplace-mech")
368
+ @click.argument(
369
+ "service-id",
370
+ type=int,
371
+ )
372
+ @click.option("--chain-config", default="gnosis", help="Chain configuration to use.")
373
+ def tools_for_marketplace_mech(service_id: int, chain_config: str) -> None:
374
+ """Fetch and display tools for marketplace mechs."""
375
+ try:
376
+ result = get_tools_for_marketplace_mech(service_id, chain_config)
377
+
378
+ headers = ["Tool Name", "Unique Identifier"]
379
+ data: List[Tuple[str, ...]] = [
380
+ (
381
+ str(tool.tool_name),
382
+ str(tool.unique_identifier),
383
+ )
384
+ for tool in result.tools
385
+ ]
386
+
387
+ click.echo(tabulate(data, headers=headers, tablefmt="grid"))
388
+
389
+ except (KeyError, TypeError) as e:
390
+ click.echo(f"Error processing tool data: {str(e)}")
391
+ except IOError as e:
392
+ click.echo(f"Network or I/O error: {str(e)}")
393
+
394
+
395
+ @click.command(name="tool-description-for-marketplace-mech")
396
+ @click.argument("tool_id")
397
+ @click.option("--chain-config", default="gnosis", help="Chain configuration to use.")
398
+ def tool_description_for_marketplace_mech(tool_id: str, chain_config: str) -> None:
399
+ """Fetch and display the description of a specific tool for marketplace mechs."""
400
+ try:
401
+ description = get_tool_description_for_marketplace_mech(tool_id, chain_config)
402
+ click.echo(f"Description for tool {tool_id}: {description}")
403
+ except KeyError as e:
404
+ click.echo(f"Tool not found or missing description: {str(e)}")
405
+ except IOError as e:
406
+ click.echo(f"Network or I/O error: {str(e)}")
407
+
408
+
409
+ @click.command(name="tool-io-schema-for-marketplace-mech")
410
+ @click.argument("tool_id")
411
+ @click.option("--chain-config", default="gnosis", help="Chain configuration to use.")
412
+ def tool_io_schema_for_marketplace_mech(tool_id: str, chain_config: str) -> None:
413
+ """Fetch and display the tool's name and description along with the input/output schema for a specific tool for marketplace mechs."""
414
+ try:
415
+ result = get_tool_io_schema_for_marketplace_mech(tool_id, chain_config)
416
+
417
+ name = result["name"]
418
+ description = result["description"]
419
+ input_schema = extract_input_schema(result["input"])
420
+ output_schema = extract_output_schema(result["output"])
421
+
422
+ click.echo("Tool Details:")
423
+ click.echo(
424
+ tabulate(
425
+ [[name, description]],
426
+ headers=["Tool Name", "Tool Description"],
427
+ tablefmt="grid",
428
+ )
429
+ )
430
+
431
+ click.echo("Input Schema:")
432
+ click.echo(tabulate(input_schema, headers=["Field", "Value"], tablefmt="grid"))
433
+ click.echo("Output Schema:")
434
+ click.echo(
435
+ tabulate(
436
+ output_schema, headers=["Field", "Type", "Description"], tablefmt="grid"
437
+ )
438
+ )
439
+ except KeyError as e:
440
+ click.echo(f"Error accessing schema data: {str(e)}")
441
+ except IOError as e:
442
+ click.echo(f"Network or I/O error: {str(e)}")
443
+
444
+
356
445
  @click.command(name="deposit-native")
357
446
  @click.argument("amount_to_deposit")
358
447
  @click.option(
@@ -423,8 +512,11 @@ cli.add_command(prompt_to_ipfs)
423
512
  cli.add_command(push_to_ipfs)
424
513
  cli.add_command(to_png)
425
514
  cli.add_command(tools_for_agents)
515
+ cli.add_command(tools_for_marketplace_mech)
426
516
  cli.add_command(tool_io_schema)
517
+ cli.add_command(tool_io_schema_for_marketplace_mech)
427
518
  cli.add_command(tool_description)
519
+ cli.add_command(tool_description_for_marketplace_mech)
428
520
  cli.add_command(deposit_native)
429
521
  cli.add_command(deposit_token)
430
522
  cli.add_command(nvm_subscribe)
@@ -3,6 +3,7 @@
3
3
  "agent_registry_contract": "0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA",
4
4
  "service_registry_contract": "0x9338b5153AE39BB89f50468E608eD9d764B755fD",
5
5
  "mech_marketplace_contract": "0x735FAAb1c4Ec41128c367AFb5c3baC73509f70bB",
6
+ "complementary_metadata_hash_address": "0x0598081D48FB80B0A7E52FAD2905AE9beCd6fC69",
6
7
  "rpc_url": "https://rpc.eu-central-2.gateway.fm/v4/gnosis/non-archival/mainnet",
7
8
  "wss_endpoint": "wss://rpc.gnosischain.com/wss",
8
9
  "ledger_config": {
@@ -21,6 +22,7 @@
21
22
  "agent_registry_contract": "0xa4799B083E0068732456EF45ff9fe5c683658327",
22
23
  "service_registry_contract": "0xE3607b00E75f6405248323A9417ff6b39B244b50",
23
24
  "mech_marketplace_contract": "0x0000000000000000000000000000000000000000",
25
+ "complementary_metadata_hash_address": "0x0000000000000000000000000000000000000000",
24
26
  "rpc_url": "https://arbitrum.llamarpc.com",
25
27
  "wss_endpoint": "wss://arbitrum.gateway.tenderly.co",
26
28
  "ledger_config": {
@@ -39,6 +41,7 @@
39
41
  "agent_registry_contract": "0x984cf72FDe8B5aA910e9e508aC5e007ae5BDcC9C",
40
42
  "service_registry_contract": "0xE3607b00E75f6405248323A9417ff6b39B244b50",
41
43
  "mech_marketplace_contract": "0x0000000000000000000000000000000000000000",
44
+ "complementary_metadata_hash_address": "0x0000000000000000000000000000000000000000",
42
45
  "rpc_url": "https://polygon-bor-rpc.publicnode.com",
43
46
  "wss_endpoint": "wss://polygon.gateway.tenderly.co",
44
47
  "ledger_config": {
@@ -57,6 +60,7 @@
57
60
  "agent_registry_contract": "0x88DE734655184a09B70700aE4F72364d1ad23728",
58
61
  "service_registry_contract": "0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE",
59
62
  "mech_marketplace_contract": "0xf24eE42edA0fc9b33B7D41B06Ee8ccD2Ef7C5020",
63
+ "complementary_metadata_hash_address": "0x28C1edC7CEd549F7f80B732fDC19f0370160707d",
60
64
  "rpc_url": "https://base.llamarpc.com",
61
65
  "wss_endpoint": "wss://base.gateway.tenderly.co",
62
66
  "ledger_config": {
@@ -75,6 +79,7 @@
75
79
  "agent_registry_contract": "0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA",
76
80
  "service_registry_contract": "0xE3607b00E75f6405248323A9417ff6b39B244b50",
77
81
  "mech_marketplace_contract": "0x0000000000000000000000000000000000000000",
82
+ "complementary_metadata_hash_address": "0x0000000000000000000000000000000000000000",
78
83
  "rpc_url": "https://forno.celo.org",
79
84
  "wss_endpoint": "wss://forno.celo.org/ws",
80
85
  "ledger_config": {
@@ -93,6 +98,7 @@
93
98
  "agent_registry_contract": "0x75D529FAe220bC8db714F0202193726b46881B76",
94
99
  "service_registry_contract": "0x3d77596beb0f130a4415df3D2D8232B3d3D31e44",
95
100
  "mech_marketplace_contract": "0x0000000000000000000000000000000000000000",
101
+ "complementary_metadata_hash_address": "0x0000000000000000000000000000000000000000",
96
102
  "rpc_url": "https://mainnet.optimism.io",
97
103
  "wss_endpoint": "wss://optimism.gateway.tenderly.co",
98
104
  "ledger_config": {
mech_client/interact.py CHANGED
@@ -120,6 +120,7 @@ class MechConfig: # pylint: disable=too-many-instance-attributes
120
120
 
121
121
  agent_registry_contract: str
122
122
  service_registry_contract: str
123
+ complementary_metadata_hash_address: str
123
124
  rpc_url: str
124
125
  wss_endpoint: str
125
126
  ledger_config: LedgerConfig
@@ -0,0 +1,223 @@
1
+ """Module for managing mechanical tools and their interactions with blockchain."""
2
+
3
+ import json
4
+ from dataclasses import asdict, dataclass
5
+ from pathlib import Path
6
+ from typing import Any, Dict, List, Optional, Tuple
7
+
8
+ import requests
9
+ from aea_ledger_ethereum import EthereumApi
10
+
11
+ from mech_client.marketplace_interact import ADDRESS_ZERO, get_contract, get_mech_config
12
+
13
+
14
+ ABI_DIR_PATH = Path(__file__).parent / "abis"
15
+ COMPLEMENTARY_METADATA_HASH_ABI_PATH = (
16
+ ABI_DIR_PATH / "ComplementaryServiceMetadata.json"
17
+ )
18
+ ENCODING = "utf-8"
19
+ DEFAULT_TIMEOUT = 10
20
+ TOOLS = "tools"
21
+ TOOL_METADATA = "toolMetadata"
22
+ DEFAULT_CONFIG = "gnosis"
23
+
24
+
25
+ @dataclass
26
+ class ToolInfo:
27
+ """Tool info"""
28
+
29
+ tool_name: str
30
+ unique_identifier: str
31
+
32
+
33
+ @dataclass
34
+ class ToolsForMarketplaceMech:
35
+ """Tools info list"""
36
+
37
+ service_id: int
38
+ tools: List[ToolInfo]
39
+
40
+
41
+ def fetch_tools(
42
+ service_id: int,
43
+ ledger_api: EthereumApi,
44
+ complementary_metadata_hash_address: str,
45
+ contract_abi_path: Path,
46
+ ) -> Dict[str, Any]:
47
+ """Fetch tools for specified mech's service ID."""
48
+ with open(contract_abi_path, encoding=ENCODING) as f:
49
+ abi = json.load(f)
50
+
51
+ metadata_contract = get_contract(
52
+ contract_address=complementary_metadata_hash_address,
53
+ abi=abi,
54
+ ledger_api=ledger_api,
55
+ )
56
+ metadata_uri = metadata_contract.functions.tokenURI(service_id).call()
57
+ return requests.get(metadata_uri, timeout=DEFAULT_TIMEOUT).json()
58
+
59
+
60
+ def get_mech_tools(
61
+ service_id: int, chain_config: str = DEFAULT_CONFIG
62
+ ) -> Optional[Dict[str, Any]]:
63
+ """
64
+ Fetch tools for a given mech's service ID.
65
+
66
+ :param service_id: The service ID of the mech.
67
+ :param chain_config: The chain configuration to use (default is "gnosis").
68
+ :return: A dictionary containing the JSON response from the `tokenURI` contract call, typically including tools and metadata.
69
+ """
70
+ # Get the mech configuration
71
+ mech_config = get_mech_config(chain_config)
72
+ ledger_config = mech_config.ledger_config
73
+
74
+ # Setup Ethereum API
75
+ ledger_api = EthereumApi(**asdict(ledger_config))
76
+
77
+ if mech_config.complementary_metadata_hash_address == ADDRESS_ZERO:
78
+ print(f"Metadata hash not yet implemented on {chain_config}")
79
+ return None
80
+
81
+ try:
82
+ # Fetch tools for the given mech's service ID
83
+ return fetch_tools(
84
+ service_id=service_id,
85
+ ledger_api=ledger_api,
86
+ complementary_metadata_hash_address=mech_config.complementary_metadata_hash_address,
87
+ contract_abi_path=COMPLEMENTARY_METADATA_HASH_ABI_PATH,
88
+ )
89
+ except (json.JSONDecodeError, NotImplementedError) as e:
90
+ print(f"An error occurred while fetching tools for mech with {service_id}: {e}")
91
+ return None
92
+
93
+
94
+ def get_tools_for_marketplace_mech(
95
+ service_id: int, chain_config: str = DEFAULT_CONFIG
96
+ ) -> ToolsForMarketplaceMech:
97
+ """
98
+ Retrieve tools for specified mech's service id.
99
+
100
+ :param service_id: specific mech's service ID to fetch tools for.
101
+ :param chain_config: The chain configuration to use.
102
+ :return: Dictionary of tools with identifiers or a mapping of service IDs to tools.
103
+ """
104
+ empty_response = ToolsForMarketplaceMech(service_id=service_id, tools=[])
105
+
106
+ try:
107
+ result = get_mech_tools(service_id, chain_config)
108
+ if result is None:
109
+ return empty_response
110
+
111
+ tools = result.get(TOOLS, [])
112
+ tool_metadata = result.get(TOOL_METADATA, {})
113
+ if not isinstance(tools, list) or not isinstance(tool_metadata, dict):
114
+ return empty_response
115
+
116
+ tools_with_ids = [
117
+ ToolInfo(tool_name=tool, unique_identifier=f"{service_id}-{tool}")
118
+ for tool in tools
119
+ ]
120
+ return ToolsForMarketplaceMech(service_id=service_id, tools=tools_with_ids)
121
+
122
+ except (json.JSONDecodeError, NotImplementedError) as e:
123
+ print(f"Error in get_tools_for_marketplace_mech: {str(e)}")
124
+ raise
125
+
126
+
127
+ def get_tool_description(
128
+ unique_identifier: str, chain_config: str = DEFAULT_CONFIG
129
+ ) -> str:
130
+ """
131
+ Fetch the description of a specific tool based on a unique identifier.
132
+
133
+ :param unique_identifier: The unique identifier for the tool.
134
+ :param chain_config: The chain configuration to use.
135
+ :return: Description of the tool or a default message if not available.
136
+ """
137
+ default_response = "Description not available"
138
+
139
+ _, tool_info = _get_tool_metadata(unique_identifier, chain_config)
140
+ return (
141
+ tool_info.get("description", default_response)
142
+ if tool_info
143
+ else default_response
144
+ )
145
+
146
+
147
+ def get_tool_io_schema(
148
+ unique_identifier: str, chain_config: str = DEFAULT_CONFIG
149
+ ) -> Dict[str, Any]:
150
+ """
151
+ Fetch the input and output schema along with tool name and description of a specific tool based on a unique identifier.
152
+
153
+ :param unique_identifier: The unique identifier for the tool.
154
+ :param chain_config: The chain configuration to use.
155
+ :return: Dictionary containing name, description, input and output schemas.
156
+ """
157
+ _, tool_info = _get_tool_metadata(unique_identifier, chain_config)
158
+ if tool_info:
159
+ return {
160
+ "name": tool_info.get("name", {}),
161
+ "description": tool_info.get("description", {}),
162
+ "input": tool_info.get("input", {}),
163
+ "output": tool_info.get("output", {}),
164
+ }
165
+
166
+ return {"input": {}, "output": {}}
167
+
168
+
169
+ def _get_tool_metadata(
170
+ unique_identifier: str, chain_config: str = DEFAULT_CONFIG
171
+ ) -> Tuple[str, Optional[Dict[str, Any]]]:
172
+ """
173
+ Helper function to extract tool metadata from the chain config and unique identifier.
174
+
175
+ :param unique_identifier: The unique identifier in the format "<service_id>-<tool_name>".
176
+ :param chain_config: The chain configuration to use.
177
+ :return: Tuple of tool name and its metadata dictionary (or None if not found).
178
+ """
179
+ service_id_str, *tool_parts = unique_identifier.split("-")
180
+ try:
181
+ service_id = int(service_id_str)
182
+ except ValueError as exc:
183
+ raise ValueError(
184
+ f"Unexpected unique identifier format: {unique_identifier}"
185
+ ) from exc
186
+ tool_name = "-".join(tool_parts)
187
+
188
+ result = get_mech_tools(service_id, chain_config)
189
+
190
+ if isinstance(result, dict):
191
+ tool_metadata = result.get(TOOL_METADATA, {})
192
+ tool_info = tool_metadata.get(tool_name)
193
+ if isinstance(tool_info, dict):
194
+ return tool_name, tool_info
195
+
196
+ return tool_name, None
197
+
198
+
199
+ def extract_input_schema(input_data: Dict[str, Any]) -> List[Tuple[str, Any]]:
200
+ """
201
+ Extract the schema from input data.
202
+
203
+ :param input_data: A dictionary representing the input data.
204
+ :return: A list of key-value pairs representing the input schema.
205
+ """
206
+ return [(key, input_data[key]) for key in input_data]
207
+
208
+
209
+ def extract_output_schema(output_data: Dict[str, Any]) -> List[Tuple[str, str, str]]:
210
+ """
211
+ Extract the output schema from the output data.
212
+
213
+ :param output_data: A dictionary representing the output data.
214
+ :return: A list of list of tuples representing the output schema.
215
+ """
216
+ schema = output_data.get("schema", {})
217
+ if "properties" not in schema:
218
+ return []
219
+
220
+ return [
221
+ (key, value.get("type", ""), value.get("description", ""))
222
+ for key, value in schema["properties"].items()
223
+ ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mech-client
3
- Version: 0.7.0
3
+ Version: 0.8.1
4
4
  Summary: Basic client to interact with a mech
5
5
  License: Apache-2.0
6
6
  Author: David Minarsch
@@ -251,8 +251,9 @@ mechx interact --prompts <prompt-1> --prompts <prompt-2> --priority-mech <priori
251
251
  ```
252
252
 
253
253
 
254
- ### List tools available for agents
254
+ ### List tools available for legacy mechs and marketplace mechs
255
255
 
256
+ #### For legacy mechs
256
257
  To list the tools available for a specific agent or for all agents, use the `tools-for-agents` command. You can specify an agent ID to get tools for a specific agent, or omit it to list tools for all agents.
257
258
 
258
259
  ```bash
@@ -293,8 +294,28 @@ You will see an output like this:
293
294
  +---------------------------------------------+-----------------------------------------------+
294
295
  ```
295
296
 
297
+ #### For marketplace mechs
298
+ To list the tools available for a specific marketplace mech, use the `tools-for-marketplace-mech` command. You can specify a service ID to get tools for a specific mech.
299
+
300
+ ```bash
301
+ mechx tools-for-marketplace-mech 1722 --chain-config gnosis
302
+ ```
303
+ ```bash
304
+ You will see an output like this:
305
+ +---------------------------------------------+-----------------------------------------------+
306
+ | Tool Name | Unique Identifier |
307
+ +=============================================+===============================================+
308
+ | claude-prediction-offline | 1722-claude-prediction-offline |
309
+ +---------------------------------------------+-----------------------------------------------+
310
+ | claude-prediction-online | 1722-claude-prediction-online |
311
+ +---------------------------------------------+-----------------------------------------------+
312
+ | deepmind-optimization | 1722-deepmind-optimization |
313
+ +---------------------------------------------+-----------------------------------------------+
314
+ ```
315
+
296
316
  ### Get Tool Description
297
317
 
318
+ #### For legacy mechs
298
319
  To get the description of a specific tool, use the `tool-description` command. You need to specify the unique identifier of the tool.
299
320
 
300
321
  ```bash
@@ -310,9 +331,26 @@ You will see an output like this:
310
331
  Description for tool 6-claude-prediction-offline: Makes a prediction using Claude
311
332
  ```
312
333
 
334
+ #### For marketplace mechs
335
+ To get the description of a specific tool, use the ` tool-description-for-marketplace-mech` command. You need to specify the unique identifier of the tool.
336
+
337
+ ```bash
338
+ mechx tool-description-for-marketplace-mech <unique_identifier> --chain-config <chain_config>
339
+ ```
340
+ Example usage:
341
+
342
+ ```bash
343
+ mechx tool-description-for-marketplace-mech 1722-openai-gpt-4 --chain-config gnosis
344
+ ```
345
+ You will see an output like this:
346
+ ```bash
347
+ Description for tool 1722-openai-gpt-4: Performs a request to OpenAI's GPT-4 model.
348
+ ```
349
+
313
350
 
314
351
  ### Get Tool Input/Output Schema
315
352
 
353
+ #### For legacy mechs
316
354
  To get the input/output schema of a specific tool, use the `tool_io_schema` command. You need to specify the unique identifier of the tool.
317
355
 
318
356
  ```bash
@@ -352,6 +390,47 @@ Output Schema:
352
390
  +-----------+---------+-----------------------------------------------+
353
391
  ```
354
392
 
393
+ #### For marketplace mechs
394
+ To get the input/output schema of a specific tool, use the `tool-io-schema-for-marketplace-mech` command. You need to specify the unique identifier of the tool.
395
+
396
+ ```bash
397
+ mechx tool-io-schema-for-marketplace-mech <unique_identifier> --chain-config <chain_config>
398
+ ```
399
+
400
+ Example usage:
401
+
402
+ ```bash
403
+ mechx tool-io-schema-for-marketplace-mech 1722-openai-gpt-4 --chain-config gnosis
404
+ ```
405
+ You will see an output like this:
406
+ ```bash
407
+ Tool Details:
408
+ Tool Details:
409
+ +------------------------+---------------------------------------------+
410
+ | Tool Name | Tool Description |
411
+ +========================+=============================================+
412
+ | OpenAI Request (GPT-4) | Performs a request to OpenAI's GPT-4 model. |
413
+ +------------------------+---------------------------------------------+
414
+ Input Schema:
415
+ +-------------+-----------------------------------------------+
416
+ | Field | Value |
417
+ +=============+===============================================+
418
+ | type | text |
419
+ +-------------+-----------------------------------------------+
420
+ | description | The request to relay to OpenAI's GPT-4 model. |
421
+ +-------------+-----------------------------------------------+
422
+ Output Schema:
423
+ +-----------+---------+-----------------------------------+
424
+ | Field | Type | Description |
425
+ +===========+=========+===================================+
426
+ | requestId | integer | Unique identifier for the request |
427
+ +-----------+---------+-----------------------------------+
428
+ | result | string | Response from OpenAI |
429
+ +-----------+---------+-----------------------------------+
430
+ | prompt | string | User prompt to send to OpenAI |
431
+ +-----------+---------+-----------------------------------+
432
+ ```
433
+
355
434
  > **:pencil2: Note** <br />
356
435
  > **If you encounter an "Out of gas" error when executing the Mech Client, you will need to increase the gas limit, e.g.,**
357
436
  >
@@ -1,4 +1,4 @@
1
- mech_client/__init__.py,sha256=7c_NFqLmrsat-J6najbiOFl9n9GrUj48mOdcK8_KUKs,42
1
+ mech_client/__init__.py,sha256=H6mfUy3jsvO3gznDqhbjyAY9Uu4NeCw-M2QfB2WThRc,42
2
2
  mech_client/abis/AgentMech.json,sha256=IEbs_xBGunBu5h-uT5DvIty8Zw412QoPI46S_DUMYNw,18082
3
3
  mech_client/abis/AgentRegistry.json,sha256=2qmXeFINZWz9pyOma6Bq67kMDSUI1lD7WvgHLwuETD8,24723
4
4
  mech_client/abis/AgreementStoreManager.base.json,sha256=_ljdIZcfFGmFzBHUTfhA4X0382ZHHpkdr_CziTwUETo,34360
@@ -7,6 +7,7 @@ mech_client/abis/BalanceTrackerFixedPriceNative.json,sha256=MF5jDqSMoZztvMV4oc5i
7
7
  mech_client/abis/BalanceTrackerFixedPriceToken.json,sha256=kaXgResUkAb6u9bVTS3T_SNRPRP76hi-jTAhMiYwq4U,12408
8
8
  mech_client/abis/BalanceTrackerNvmSubscriptionNative.json,sha256=D23ibyhDsn4vjozFvzcKw-7wJpGM-R5GiqlcmyBIpcY,16536
9
9
  mech_client/abis/BalanceTrackerNvmSubscriptionToken.json,sha256=4Bra0DdEi_pQUSD4hGdELOvjNL013GaJc-dANr--5D8,16204
10
+ mech_client/abis/ComplementaryServiceMetadata.json,sha256=ywbXSjIQhUchxKMClqKGdcHRhMb8Z9s93OjcHtRRYrY,4256
10
11
  mech_client/abis/DIDRegistry.base.json,sha256=l6UZe4SU9nMh0PvmTS5gfwd6bBM7_BT5mRyASOFyGxw,92562
11
12
  mech_client/abis/DIDRegistry.gnosis.json,sha256=piDWd8nipLcI3NkMu0o2RsQkTS9m7gjDp-yLtPpcjEc,92562
12
13
  mech_client/abis/EscrowPaymentCondition.base.json,sha256=Z0zr_E2Cxjfg_aHF-VLPeOQ9kAy51_aRcw-OuIPQ7zY,34475
@@ -29,8 +30,8 @@ mech_client/abis/SubscriptionToken.base.json,sha256=5StPEyfRvDMTqtQPO-KakXXZqobX
29
30
  mech_client/abis/TransferNFTCondition.base.json,sha256=71O_3itHBz9qPtoTLev8_a7KxlcQfIZSfxK2562lkqw,42540
30
31
  mech_client/abis/TransferNFTCondition.gnosis.json,sha256=-huhxV54eoNY8mR9WtQdmSgQDgaKiUi0PULJ4HEshWw,42540
31
32
  mech_client/acn.py,sha256=Rj_jLPvJ5loDQfGbu3a_O24cJC4SwIErLceSz_zVYS8,5356
32
- mech_client/cli.py,sha256=8cZ7kQvXRk3GZHj_wtGw8cQXYctkY1eLuACMBSdnZb4,14049
33
- mech_client/configs/mechs.json,sha256=Sh-W0ZqkktSD8HokU5InoFIlqvKoq7nDlIY0fB8P6Y8,4887
33
+ mech_client/cli.py,sha256=XezX27Y0VdnUq8HmHF6HxyhPmsC91YuLSuqAoi41UrE,17655
34
+ mech_client/configs/mechs.json,sha256=Zv8JrY6yvNsSxTP7RchvR1yz2k3yjYUZkuSILnPbWzg,5445
34
35
  mech_client/fetch_ipfs_hash.py,sha256=tg_hYVf4deXl89x3SOBrGFUthaSeN_Vg_OHDtfjdbp4,2752
35
36
  mech_client/helpers/__init__.py,sha256=nmQig1EqBQ9EMOpgdykP3a6_2NWcoVH3-lnyHP5n0ws,1196
36
37
  mech_client/helpers/acn/README.md,sha256=WMXR2Lk0IpWjr3vpZ8cxcTHk4gwsx4wC06UPkwj9dbQ,1641
@@ -60,16 +61,17 @@ mech_client/helpers/p2p_libp2p_client/README.md,sha256=6x9s6P7TdKkcvAS1wMFHXRz4a
60
61
  mech_client/helpers/p2p_libp2p_client/__init__.py,sha256=-GOP3D_JnmXTDomrMLCbnRk7vRQmihIqTYvyIPzx-q4,879
61
62
  mech_client/helpers/p2p_libp2p_client/connection.py,sha256=b5jfcUeSoNrUw8DOSTCbK4DTi-N8bf2_pdogUOz0ep0,28606
62
63
  mech_client/helpers/p2p_libp2p_client/connection.yaml,sha256=nMiHnU_dv9EFjVNqZ-0SAnoATfadJSad-JsbDvk97Mk,1790
63
- mech_client/interact.py,sha256=h3li0N79M1MaVXggONFzs_rNEr6WcG8fof_UtykSZyQ,21243
64
+ mech_client/interact.py,sha256=52UW5NysSTIC--APLpJde8VvrruWeYFCFzO02uRQpwc,21288
64
65
  mech_client/marketplace_interact.py,sha256=rRIHYLzuaXYW7vh4fvNh9KBbUY4tgoavmMxFaPg0Rkw,33045
66
+ mech_client/mech_marketplace_tool_management.py,sha256=q_cXyJGI1rLXKB_Ds21eQLCzUhTYE9BHN48wqIw0w6g,7341
65
67
  mech_client/mech_tool_management.py,sha256=NQFmVzzGZsIkeHokDPWXGHwa8u-pyQIMPR1Q5H81bKw,7806
66
68
  mech_client/prompt_to_ipfs.py,sha256=XqSIBko15MEkpWOQNT97fRI6jNxMF5EDBDEPOJFdhyk,2533
67
69
  mech_client/push_to_ipfs.py,sha256=IfvgaPU79N_ZmCPF9d7sPCYz2uduZH0KjT_HQ2LHXoQ,2059
68
70
  mech_client/subgraph.py,sha256=MiyWiLPkqtXS9qayT75xYM6tz2pxd2Q6iE92yZxDugw,4700
69
71
  mech_client/to_png.py,sha256=pjUcFJ63MJj_r73eqnfqCWMtlpsrj6H4ZmgvIEmRcFw,2581
70
72
  mech_client/wss.py,sha256=N38eprKqwHyQpqGa6XZ9ZUwJ_YO50wlBJqJ5D1QCIj4,9888
71
- mech_client-0.7.0.dist-info/LICENSE,sha256=mdBDB-mWKV5Cz4ejBzBiKqan6Z8zVLAh9xwM64O2FW4,11339
72
- mech_client-0.7.0.dist-info/METADATA,sha256=_PyR4Yy_qFuQLa5jQzuFPWvNyiFbcwezmwHlptK2qdA,21494
73
- mech_client-0.7.0.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
74
- mech_client-0.7.0.dist-info/entry_points.txt,sha256=SbRMRsayzD8XfNXhgwPuXEqQsdZ5Bw9XDPnUuaDExyY,45
75
- mech_client-0.7.0.dist-info/RECORD,,
73
+ mech_client-0.8.1.dist-info/LICENSE,sha256=mdBDB-mWKV5Cz4ejBzBiKqan6Z8zVLAh9xwM64O2FW4,11339
74
+ mech_client-0.8.1.dist-info/METADATA,sha256=7FyF1UwwIe5-EmE1vYk16-wz94fA1IHycPPY5xd8Oo4,25165
75
+ mech_client-0.8.1.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
76
+ mech_client-0.8.1.dist-info/entry_points.txt,sha256=SbRMRsayzD8XfNXhgwPuXEqQsdZ5Bw9XDPnUuaDExyY,45
77
+ mech_client-0.8.1.dist-info/RECORD,,