Change --tool-args to --tool-arg for consistency
This commit is contained in:
34
README.md
34
README.md
@@ -89,7 +89,7 @@ npx @modelcontextprotocol/inspector --cli --config path/to/config.json --server
|
||||
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/list
|
||||
|
||||
# Call a specific tool
|
||||
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/call --tool-name mytool --tool-args key=value --tool-args another=value2
|
||||
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/call --tool-name mytool --tool-arg key=value --tool-arg another=value2
|
||||
|
||||
# List available resources
|
||||
npx @modelcontextprotocol/inspector --cli node build/index.js --method resources/list
|
||||
@@ -101,38 +101,8 @@ npx @modelcontextprotocol/inspector --cli node build/index.js --method prompts/l
|
||||
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com
|
||||
|
||||
# Call a tool on a remote server
|
||||
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com --method tools/call --tool-name remotetool --tool-args param=value
|
||||
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com --method tools/call --tool-name remotetool --tool-arg param=value
|
||||
|
||||
# List resources from a remote server
|
||||
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com --method resources/list
|
||||
```
|
||||
|
||||
For more details on ways to use the inspector, see the [Inspector section of the MCP docs site](https://modelcontextprotocol.io/docs/tools/inspector). For help with debugging, see the [Debugging guide](https://modelcontextprotocol.io/docs/tools/debugging).
|
||||
|
||||
### From this repository
|
||||
|
||||
If you're working on the inspector itself:
|
||||
|
||||
Development mode:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
> **Note for Windows users:**
|
||||
> On Windows, use the following command instead:
|
||||
>
|
||||
> ```bash
|
||||
> npm run dev:windows
|
||||
> ```
|
||||
|
||||
Production mode:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
npm start
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License—see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
@@ -21,7 +21,7 @@ echo -e "${BLUE}- Environment variables (-e)${NC}"
|
||||
echo -e "${BLUE}- Config file (--config)${NC}"
|
||||
echo -e "${BLUE}- Server selection (--server)${NC}"
|
||||
echo -e "${BLUE}- Method selection (--method)${NC}"
|
||||
echo -e "${BLUE}- Tool-related options (--tool-name, --tool-args)${NC}"
|
||||
echo -e "${BLUE}- Tool-related options (--tool-name, --tool-arg)${NC}"
|
||||
echo -e "${BLUE}- Resource-related options (--uri)${NC}"
|
||||
echo -e "${BLUE}- Prompt-related options (--prompt-name, --prompt-args)${NC}"
|
||||
echo -e "${BLUE}- Logging options (--log-level)${NC}"
|
||||
@@ -171,16 +171,16 @@ run_error_test "nonexistent_server" "--config" "$PROJECT_ROOT/sample-config.json
|
||||
echo -e "\n${YELLOW}=== Running Tool-Related Tests ===${NC}"
|
||||
|
||||
# Test 12: CLI mode with tool call
|
||||
run_basic_test "tool_call" "${TEST_CMD}" "${TEST_ARGS[@]}" "--cli" "--method" "tools/call" "--tool-name" "echo" "--tool-args" "message=Hello"
|
||||
run_basic_test "tool_call" "${TEST_CMD}" "${TEST_ARGS[@]}" "--cli" "--method" "tools/call" "--tool-name" "echo" "--tool-arg" "message=Hello"
|
||||
|
||||
# Test 13: CLI mode with tool call but missing tool name (should fail)
|
||||
run_error_test "missing_tool_name" "${TEST_CMD}" "${TEST_ARGS[@]}" "--cli" "--method" "tools/call" "--tool-args" "message=Hello"
|
||||
run_error_test "missing_tool_name" "${TEST_CMD}" "${TEST_ARGS[@]}" "--cli" "--method" "tools/call" "--tool-arg" "message=Hello"
|
||||
|
||||
# Test 14: CLI mode with tool call but invalid tool args format (should fail)
|
||||
run_error_test "invalid_tool_args" "${TEST_CMD}" "${TEST_ARGS[@]}" "--cli" "--method" "tools/call" "--tool-name" "echo" "--tool-args" "invalid_format"
|
||||
run_error_test "invalid_tool_args" "${TEST_CMD}" "${TEST_ARGS[@]}" "--cli" "--method" "tools/call" "--tool-name" "echo" "--tool-arg" "invalid_format"
|
||||
|
||||
# Test 15: CLI mode with multiple tool args
|
||||
run_basic_test "multiple_tool_args" "${TEST_CMD}" "${TEST_ARGS[@]}" "--cli" "--method" "tools/call" "--tool-name" "add" "--tool-args" "a=1" "b=2"
|
||||
run_basic_test "multiple_tool_args" "${TEST_CMD}" "${TEST_ARGS[@]}" "--cli" "--method" "tools/call" "--tool-name" "add" "--tool-arg" "a=1" "b=2"
|
||||
|
||||
echo -e "\n${YELLOW}=== Running Resource-Related Tests ===${NC}"
|
||||
|
||||
@@ -218,7 +218,7 @@ echo -e "${BLUE}Testing combined options with environment variables and config f
|
||||
run_basic_test "combined_options" "--config" "$PROJECT_ROOT/sample-config.json" "--server" "everything" "-e" "CLI_ENV_VAR=cli_value" "--cli" "--method" "tools/list"
|
||||
|
||||
# Test 24: CLI mode with all possible options (that make sense together)
|
||||
run_basic_test "all_options" "--config" "$PROJECT_ROOT/sample-config.json" "--server" "everything" "-e" "CLI_ENV_VAR=cli_value" "--cli" "--method" "tools/call" "--tool-name" "echo" "--tool-args" "message=Hello" "--log-level" "debug"
|
||||
run_basic_test "all_options" "--config" "$PROJECT_ROOT/sample-config.json" "--server" "everything" "-e" "CLI_ENV_VAR=cli_value" "--cli" "--method" "tools/call" "--tool-name" "echo" "--tool-arg" "message=Hello" "--log-level" "debug"
|
||||
|
||||
# Print test summary
|
||||
echo -e "\n${YELLOW}=== Test Summary ===${NC}"
|
||||
|
||||
@@ -28,7 +28,7 @@ type Args = {
|
||||
uri?: string;
|
||||
logLevel?: LogLevel;
|
||||
toolName?: string;
|
||||
toolArgs?: Record<string, string>;
|
||||
toolArg?: Record<string, string>;
|
||||
};
|
||||
|
||||
function createTransportOptions(target: string[]): TransportOptions {
|
||||
@@ -81,7 +81,7 @@ async function callMethod(args: Args): Promise<void> {
|
||||
);
|
||||
}
|
||||
|
||||
result = await callTool(client, args.toolName, args.toolArgs || {});
|
||||
result = await callTool(client, args.toolName, args.toolArg || {});
|
||||
}
|
||||
// Resources methods
|
||||
else if (args.method === "resources/list") {
|
||||
@@ -177,8 +177,8 @@ function parseArgs(): Args {
|
||||
//
|
||||
.option("--tool-name <toolName>", "Tool name (for tools/call method)")
|
||||
.option(
|
||||
"--tool-args <pairs...>",
|
||||
"Tool arguments as key=value pairs",
|
||||
"--tool-arg <pairs...>",
|
||||
"Tool argument as key=value pair",
|
||||
parseKeyValuePair,
|
||||
{},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user