Skip to content

refactor: flatten create* tool factories into plain instances - #1835

Merged
avoidwork merged 3 commits into
mainfrom
refactor/tools
Nov 15, 2026
Merged

avoidwork merged 3 commits into
mainfrom
refactor/tools

Conversation

@avoidwork

Copy link
Copy Markdown
Owner

Description

Flatten the five no-arg create*Tool() factories (graphql, json, yaml, data, webhook) into plain tool() instances exported directly, matching the jira/confluence pattern. These factories were pure indirection — invoked with no arguments and injecting nothing. createApiTool remains a factory because it requires server-side config (allowlist, rate limit, credentials) and sandbox allowedPaths at build time.

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes)
  • Performance improvement
  • CI / build / tooling

Testing

Updated the affected unit tests (json, yaml, data, graphql, webhook) to use the flattened tool instances instead of calling the factories. Full suite passes via npm run coverage (set -o pipefail, exit 0), lint clean (0 errors), and coverage regenerated.

Coverage

  • Line coverage maintained

Checklist

  • npm run lint passes
  • Tests pass with maintained line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

Replace the no-arg createGraphqlTool/createJsonTool/createYamlTool/
createDataTool/createWebhookTool factories with plain tool() instances
exported directly, matching the jira/confluence pattern. These factories
were pure indirection - invoked with no arguments and injecting nothing.
createApiTool remains a factory because it requires server-side config
(allowlist, rate limit, credentials) and sandbox allowedPaths at build time.

Update the tool registry (src/tools/index.js) to import the instances
directly and push them without calling (), and update the affected tests.
@avoidwork avoidwork self-assigned this Nov 15, 2026
Rename the flattened tool exports to match the git/jira/confluence
convention: graphqlTool -> graphql, jsonTool -> json, yamlTool -> yaml,
dataTool -> data, webhookTool -> webhook. The graphql JSON-string wrapper
is renamed to graphqlRequest to free up the 'graphql' identifier.

Update the tool registry imports and the affected unit tests.
Reflect that only the api tool uses a factory (createApiTool with runtime
config injection); graphql/json/yaml/data/webhook are now plain tool()
instances exported directly under their tool names.
@avoidwork
avoidwork merged commit 3ac3bd1 into main Nov 15, 2026
2 checks passed
@avoidwork
avoidwork deleted the refactor/tools branch November 15, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant