Add args support for github and playwright tools in frontmatter#1130
Add args support for github and playwright tools in frontmatter#1130
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot use proper quoting when generating the yaml with args. Look for existing helpers or use Go quoted string format support. |
…ywright Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
|
||
| // getPlaywrightCustomArgs extracts custom args from Playwright tool configuration | ||
| func getPlaywrightCustomArgs(playwrightTool any) []string { | ||
| if toolConfig, ok := playwrightTool.(map[string]any); ok { |
There was a problem hiding this comment.
@copilot create helper function to extract args, move to args.go
There was a problem hiding this comment.
Created pkg/workflow/args.go with helper function extractCustomArgs() that consolidates the extraction logic. Moved getGitHubCustomArgs() and getPlaywrightCustomArgs() to use this shared helper (commit 157012c).
|
|
||
| // getGitHubCustomArgs extracts custom args from GitHub tool configuration | ||
| func getGitHubCustomArgs(githubTool any) []string { | ||
| if toolConfig, ok := githubTool.(map[string]any); ok { |
…ration Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Updated to use |
…elper functions Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot only chromium available in headless mode, do not use in documentation samples |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added documentation and test workflows (commits 0533fd8, 5b081a7): Documentation:
Test Workflows:
All workflows compile successfully and generate proper MCP configurations with escaped args. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| playwright: | ||
| version: "latest" # Optional: Playwright version | ||
| allowed_domains: ["defaults", "github", "*.custom.com"] # Domain access control | ||
| args: ["--browser", "firefox"] # Optional: additional command-line arguments |
| - Browser selection: `["--browser", "firefox"]` or `["--browser", "chromium"]` | ||
| - Custom flags for debugging or testing scenarios | ||
|
|
||
| **Note**: Only Chromium is available in headless mode. |
There was a problem hiding this comment.
@copilot remove mention of choosing browser, only chromium is supported
There was a problem hiding this comment.
Removed browser selection examples and updated note to clarify that only Chromium browser is supported (commit 5ac2a96).
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Summary: Add args support for github and playwright tools ✅
This PR successfully adds support for optional "args" argument for github and playwright tools in the frontmatter, allowing users to customize MCP server behavior.
Changes completed:
pkg/workflow/mcps.goto extract and return args from tool configurationpkg/parser/mcp.goto handle args field in processBuiltinMCPTool for github and playwrightpkg/workflow/custom_engine.go- renderGitHubMCPConfig and renderPlaywrightMCPConfigpkg/workflow/copilot_engine.go- renderGitHubCopilotMCPConfig and renderPlaywrightCopilotMCPConfigpkg/workflow/claude_engine.go- renderGitHubClaudeMCPConfig and renderPlaywrightMCPConfigpkg/workflow/codex_engine.go- renderGitHubCodexMCPConfig and renderPlaywrightCodexMCPConfigjson.Marshalfor args ✅args.gofile with helper functions ✅make agent-finishto verify all changes ✅Implementation details:
Helper functions (
pkg/workflow/args.go):extractCustomArgs()- Generic extraction helper for tool argsgetGitHubCustomArgs()- Extracts custom args from GitHub tool configgetPlaywrightCustomArgs()- Extracts custom args from Playwright tool configwriteArgsToYAML()- Writes args to YAML with proper JSON quoting (multi-line)writeArgsToYAMLInline()- Writes args to YAML inline (single-line format)[]anyand[]stringformatsjson.Marshalfor proper quoting and escapingParser updates (
pkg/parser/mcp.go):processBuiltinMCPTool()to append custom args after default argsEngine renderer updates:
Schema updates (
pkg/parser/schemas/main_workflow_schema.json):argsfield definition for both github and playwright toolsValidation fix (
pkg/workflow/mcp-config.go):argsfrom MCP-defining fields ingetRawMCPConfig()Comprehensive tests (
pkg/workflow/args_field_test.go):Documentation:
docs/src/content/docs/reference/tools.mdwith detailed args configuration examples.github/instructions/github-agentic-workflows.instructions.mdwith args usage patternsTest Workflows:
pkg/cli/workflows/test-github-args.md- Demonstrates GitHub tool args with--verboseflagpkg/cli/workflows/test-playwright-args.md- Demonstrates Playwright args with browser selectionpkg/cli/workflows/test-args-special-chars.md- Tests special character escaping (spaces, key=value formats)Code Organization:
pkg/workflow/args.gofile with all args-related helper functionspkg/workflow/mcps.goTest results:
Usage example:
Documentation and Examples:
Users can reference:
docs/src/content/docs/reference/tools.md- Detailed args configuration guide.github/instructions/github-agentic-workflows.instructions.md- Args usage patternspkg/cli/workflows/test-*-args.md- Working examples demonstrating various args configurationsOriginal prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.