Files
promptfoo--promptfoo/examples/openai-mcp/promptfooconfig.approval.yaml
T
wehub-resource-sync 0d3cb498a3
CI / Shell Format Check (push) Has been cancelled
CI / Check Ruby (3.4) (push) Has been cancelled
CI / CI Config (push) Has been cancelled
CI / Test on Node ${{ matrix.node }} and ${{ matrix.os }}${{ matrix.shard && format(' (shard {0}/3)', matrix.shard) || '' }} (push) Has been cancelled
CI / Build on Node ${{ matrix.node }} (push) Has been cancelled
CI / Style Check (push) Has been cancelled
CI / Generate Assets (push) Has been cancelled
CI / Check Python (3.14) (push) Has been cancelled
CI / Check Python (3.9) (push) Has been cancelled
CI / Build Docs (push) Has been cancelled
CI / Code Scan Action (push) Has been cancelled
CI / Site tests (push) Has been cancelled
CI / webui tests (push) Has been cancelled
CI / Run Integration Tests (push) Has been cancelled
CI / Run Smoke Tests (push) Has been cancelled
CI / Go Tests (push) Has been cancelled
CI / Share Test (push) Has been cancelled
CI / Redteam (Production API) (push) Has been cancelled
CI / Redteam (Staging API) (push) Has been cancelled
CI / GitHub Actions Lint (push) Has been cancelled
CI / Check Ruby (3.0) (push) Has been cancelled
release-please / release-please (push) Has been cancelled
release-please / build (push) Has been cancelled
release-please / publish-npm (push) Has been cancelled
release-please / publish-npm-backfill (push) Has been cancelled
release-please / docker (push) Has been cancelled
release-please / publish-code-scan-action (push) Has been cancelled
release-please / attest-code-scan-action (push) Has been cancelled
Deploy local.promptfoo.app / Deploy to Cloudflare Pages (push) Has been cancelled
Test and Publish Multi-arch Docker Image / test (push) Has been cancelled
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-amd64 platform:linux/amd64 runner:ubuntu-latest]) (push) Has been cancelled
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-arm64 platform:linux/arm64 runner:ubuntu-24.04-arm]) (push) Has been cancelled
Test and Publish Multi-arch Docker Image / merge-docker-digests (push) Has been cancelled
Test and Publish Multi-arch Docker Image / Attest Multi-arch Image (push) Has been cancelled
Validate Renovate Config / Validate Renovate Configuration (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:24:08 +08:00

96 lines
3.4 KiB
YAML

# yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
description: MCP approval workflow examples
prompts:
- 'Search for information about {{query}} in the {{repo}} repository'
- 'What are the latest updates in {{repo}}?'
providers:
# Provider with approval required (default behavior)
- id: openai:responses:gpt-4.1-2025-04-14
label: 'With Approval Required'
config:
tools:
- type: mcp
server_label: deepwiki
server_url: https://mcp.deepwiki.com/mcp
# require_approval is not specified, so approval is required by default
max_output_tokens: 1000
temperature: 0.2
instructions: 'You are a research assistant. When approval is required for MCP tools, explain what you would do if the tool were approved.'
# Provider with selective approval
- id: openai:responses:gpt-4.1-2025-04-14
label: 'Selective Approval'
config:
tools:
- type: mcp
server_label: deepwiki
server_url: https://mcp.deepwiki.com/mcp
require_approval:
never:
tool_names: ['read_wiki_structure']
# ask_question will still require approval, but read_wiki_structure won't
max_output_tokens: 1000
temperature: 0.2
instructions: 'You are a research assistant. Use the available tools to gather information.'
# Provider with no approval required
- id: openai:responses:gpt-4.1-2025-04-14
label: 'No Approval Required'
config:
tools:
- type: mcp
server_label: deepwiki
server_url: https://mcp.deepwiki.com/mcp
require_approval: never
max_output_tokens: 1000
temperature: 0.2
instructions: 'You are a research assistant. Use the available MCP tools to search for information.'
tests:
- vars:
query: 'getting started guide'
repo: 'facebook/react'
assert:
# For approval-required provider, expect either approval request or explanation
- type: contains-any
value: ['MCP Tool Result', 'react', 'React', 'would search', 'would look']
# Should not have tool errors
- type: not-contains
value: 'MCP Tool Error'
- type: llm-rubric
value: 'The response provides information about React or explains what would be searched'
- vars:
query: 'API documentation'
repo: 'openai/openai-python'
assert:
# Test different approval behaviors across providers
- type: contains-any
value: ['API', 'MCP Tool Result', 'Python', 'client']
# Validate that at least one provider succeeded with MCP tools
- type: contains-any
value: ['MCP Tool Result', 'documentation', 'API client', 'library']
- type: llm-rubric
value: 'The response mentions API documentation or explains the search intent'
# Add a test specifically for approval workflow validation
- vars:
query: 'installation instructions'
repo: 'nodejs/node'
assert:
# Comprehensive approval workflow testing
- type: contains-any
value: ['MCP Tool Result', 'installation', 'Node.js', 'setup']
metric: mcp_interaction_detected
# Ensure no unexpected errors
- type: not-contains
value: 'MCP Tool Error'
weight: 0.4
# Quality check regardless of approval status
- type: llm-rubric
value: 'The response addresses installation, setup, or Node.js information'
weight: 0.6