Repository navigation
refactor: flatten create* tool factories into plain instances - #1835
Merged
Merged
Conversation
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Flatten the five no-arg
create*Tool()factories (graphql, json, yaml, data, webhook) into plaintool()instances exported directly, matching the jira/confluence pattern. These factories were pure indirection — invoked with no arguments and injecting nothing.createApiToolremains a factory because it requires server-side config (allowlist, rate limit, credentials) and sandboxallowedPathsat build time.Type of Change
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
Checklist
npm run lintpasses