Add fully-typed Tools struct and parser for tools section#1941
Add fully-typed Tools struct and parser for tools section#1941
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
|
||
| // getToolFromWorkflowData is a helper to get a tool configuration from WorkflowData | ||
| // It checks ParsedTools first, and falls back to the raw Tools map for backwards compatibility | ||
| func getToolFromWorkflowData(data *WorkflowData, toolName string) any { |
There was a problem hiding this comment.
Done in commit b81aaa7. Removed tools_helpers.go file containing untyped helper functions. Users should now access tools directly via the typed data.ParsedTools field.
| // getPlaywrightConfigFromWorkflowData is a helper to get Playwright tool configuration from WorkflowData | ||
| // Returns the configuration as a typed struct when ParsedTools is available, or the raw value otherwise | ||
| // nolint:unused // Public API for accessing parsed tool configuration | ||
| func getPlaywrightConfigFromWorkflowData(data *WorkflowData) any { |
There was a problem hiding this comment.
Done in commit b81aaa7. Removed all untyped functions that returned any. Tools should be accessed directly via typed fields like data.ParsedTools.GitHub instead.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot format lint and remove dead code |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in commit 70a1c52. Formatted code with
All tests passing ✓ |
| raw map[string]any | ||
|
|
||
| // Track which known tools are explicitly set (even if nil) | ||
| hasGitHub bool |
There was a problem hiding this comment.
@copilot can we infer this field by checking for nil instead?
There was a problem hiding this comment.
Done in commit 2b8fd8e. Removed all has* tracking fields and simplified to use direct nil checks instead (e.g., t.GitHub != nil instead of t.hasGitHub).
| // Extract custom MCP tools (anything not in the known list) | ||
| knownTools := map[string]bool{ | ||
| "github": true, | ||
| "claude": true, |
There was a problem hiding this comment.
@copilot remove the "claude" tool, it is deprecated.
There was a problem hiding this comment.
Done in commit 2b8fd8e. Removed the deprecated Claude tool including ClaudeToolConfig type, parseClaudeTool function, and related tests.
… has* flags Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot remove "claude" tool from jsom schema (do not modify agentic engine) |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in commit 31dee9f. Removed claude tool from both JSON schemas (main_workflow_schema.json and included_file_schema.json) while preserving all claude engine references. Updated related tests. |
|
Agentic Changeset Generator triggered by this pull request. |
|
@copilot up the jqschema shared agentic workflow to update the step that creates the script to create the /tmp/gh-aw/ folder before writing to it |
…ript shared workflow Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in commit 7c4b8ed. Added |
Overview
This PR adds a structured
Toolstype to represent the parsed tools section from workflow frontmatter, providing fully type-safe access to tool configurations with zeroanytypes and minimal API surface.Problem
Currently, tools are accessed throughout the codebase using direct map access with type assertions:
This approach:
Solution
Introduced a structured
Toolstype with fully-typed fields and direct field access:1. Fully-Typed Tools Struct
2. All Config Structs Are Fully Typed
3. Direct Type-Safe Field Access
4. Backwards Compatibility
Changes Made
Tools Type System (
pkg/workflow/tools_types.go)anytypes in tool configurationsHasTool()andGetToolNames()methods, encouraging direct field accessSchema Updates
pkg/parser/schemas/main_workflow_schema.json- Removed claude tool definition (lines 1660-1702)pkg/parser/schemas/included_file_schema.json- Removed claude tool definition (lines 155-185)WorkflowData Integration
ParsedTools *Toolsfield toWorkflowDataShared Workflow Fix
mkdir -p /tmp/gh-aw/aw-promptsto ensure directory exists before writing filesBenefits
anytypes - all tool configurations are properly typedTesting
Example Usage
Future Work
This infrastructure enables:
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.