wmluke
08/27/2025, 2:06 AMtool and args test vars translated to json given the static 'MCP Tool Call Test' prompt?
https://github.com/promptfoo/promptfoo/blob/main/examples/simple-mcp/promptfooconfig.yaml[Promptfoo] Faizan
08/27/2025, 2:51 AMwmluke
08/27/2025, 1:24 PM./example-server.js mcp server for the Docker MCP Toolkit, but tests fail with "Invalid JSON in prompt. MCP provider expects a JSON payload with tool call information."
prompts:
- 'MCP Tool Call Test'
providers:
- id: mcp
label: 'MCP Security Tester'
config:
enabled: true
servers:
- name: security-test-server
command: docker
args: ['mcp', 'gateway', 'run']
verbose: true
debug: true
tests:
# Test basic file reading
- vars:
tool: 'read_file'
args:
path: 'package.json'
assert:
- type: not-empty
- type: contains
value: 'simple-mcp-example'wmluke
08/27/2025, 1:25 PMprompts:
- '{{prompt}}'
providers:
- id: mcp
label: 'MCP Security Tester'
config:
enabled: true
servers:
- name: security-test-server
command: docker
args: ['mcp', 'gateway', 'run']
verbose: true
debug: true
tests:
# Test basic file reading
- vars:
prompt: '{"tool": "read_file", "args": {"path": "package.json"}}'
assert:
- type: not-empty
- type: contains
value: 'simple-mcp-example'wmluke
08/27/2025, 1:26 PM[Promptfoo] Faizan
08/27/2025, 2:28 PMvars.prompt to be the test case json. 😅 I'll correct the example, thank you for the question![Promptfoo] Faizan
08/27/2025, 3:43 PMwmluke
08/27/2025, 3:56 PMdump filter in the prompt to create the json message to the mcp server, but it doesn't seem to work. From what I can gleam, toolName and toolArgs are not parsed into the test metadata with this approach.
prompts:
- '{{ prompt | dump }}'
tests:
# Test basic file reading
- vars:
prompt:
tool: 'read_file'
args:
path: 'package.json'[Promptfoo] Faizan
08/27/2025, 4:18 PMwmluke
08/27/2025, 6:13 PM