call.mdโข3.02 kB
# `call` Command
Call a tool from a template (via stdio or HTTP transport).
## Functionality
- Executes the specified tool, prompting for missing configuration if needed.
- Handles both stdio and HTTP transports.
- Displays results in user-friendly tabular format by default.
- Provides raw JSON output when using the `--raw` flag.
## Syntax
```
call [options] <template_name> <tool_name> [json_args]
```
## Options & Arguments
- `<template_name>`: Name of the template to use.
- `<tool_name>`: Name of the tool to call.
- `[json_args]`: Optional JSON string of arguments for the tool (e.g. '{"param": "value"}').
### Options
- `-c, --config-file`: Path to JSON config file
- `-e, --env`: Environment variables (KEY=VALUE format, can be used multiple times)
- `-C, --config`: Temporary config KEY=VALUE pairs (can be used multiple times)
- `-NP, --no-pull`: Do not pull the Docker image
- `-R, --raw`: Show raw JSON response instead of formatted table
## Configuration
- Configuration for the template may be required; CLI will prompt if missing.
- For HTTP templates, server must be running.
## Examples
### Basic call with tabular output (default)
```
call demo say_hello '{"name": "Sam"}'
```
### Using raw JSON output
```
call --raw demo say_hello '{"name": "Sam"}'
```
### With configuration options
```
call --config-file config.json --env API_KEY=xyz demo my_tool '{"input": "value"}'
```
## When and How to Run
- Use to execute a tool from a deployed template.
- Run after configuring the template and ensuring the server is running (for HTTP transport).
## Example Output
### Default Tabular Format
```
mcpt> call demo say_hello {"name": "Sam"}
๐ Calling tool 'say_hello' from template 'demo'
Checking for running server (HTTP first, stdio fallback)...
๐ฏ say_hello Results
โญโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Type โ Content โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ text โ Hello Sam! Greetings from "MCP Platform"! โ
โฐโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
```
### Raw JSON Format (--raw flag)
```
mcpt> call --raw demo say_hello {"name": "Sam"}
๐ Calling tool 'say_hello' from template 'demo'
Checking for running server (HTTP first, stdio fallback)...
Tool Result: say_hello
โโโ content
โ โโโ [0]
โ โโโ type: text
โ โโโ text: Hello Sam! Greetings from "MCP Platform"!
โโโ structuredContent
โ โโโ result: Hello Sam! Greetings from "MCP Platform"!
โโโ isError: โ
```