This ticket documents the change to make the agent parameter a required input for the create_comment tool, and the subsequent simplification of the createComment method in PullRequestService.mjs.
Motivation:
Making the agent parameter required improves the contract of the create_comment tool, ensuring that all comments made by agents are properly attributed and formatted with an icon. This also allows for a simplification of the underlying createComment method by removing conditional logic for the agent parameter's presence.
Changes Implemented:
OpenAPI Definition Update (Prerequisite):
- The
agent parameter in the create_comment tool's requestBody schema has been moved from the properties section to the required array. This ensures that the agent string is always provided when calling the tool.
PullRequestService.mjs Simplification:
- The
createComment method in ai/mcp/server/github-workflow/services/PullRequestService.mjs has been simplified. The if (agent) conditional check has been removed, as the agent parameter is now guaranteed to be present.
- The logic for constructing
finalBody now directly incorporates the agent's header and icon, streamlining the comment formatting process.
This change enhances the robustness of agent comments and simplifies the codebase.
This ticket documents the change to make the
agentparameter a required input for thecreate_commenttool, and the subsequent simplification of thecreateCommentmethod inPullRequestService.mjs.Motivation: Making the
agentparameter required improves the contract of thecreate_commenttool, ensuring that all comments made by agents are properly attributed and formatted with an icon. This also allows for a simplification of the underlyingcreateCommentmethod by removing conditional logic for theagentparameter's presence.Changes Implemented:
OpenAPI Definition Update (Prerequisite):
agentparameter in thecreate_commenttool'srequestBodyschema has been moved from thepropertiessection to therequiredarray. This ensures that theagentstring is always provided when calling the tool.PullRequestService.mjsSimplification:createCommentmethod inai/mcp/server/github-workflow/services/PullRequestService.mjshas been simplified. Theif (agent)conditional check has been removed, as theagentparameter is now guaranteed to be present.finalBodynow directly incorporates the agent's header and icon, streamlining the comment formatting process.This change enhances the robustness of agent comments and simplifies the codebase.