Skip to content

Conversation

@jameslong
Copy link
Owner

This pull request includes a series of changes to improve the Vancouver module by renaming, refactoring, and adding functionality. The most significant updates include renaming JsonRpc2 to JsonRpc, refactoring methods to simplify their implementation, introducing a new CodeReview prompt, and enhancing test coverage for prompts and tools.

Renaming and Refactoring

  • Renamed JsonRpc2 to JsonRpc across the codebase, including the module definition, aliases, and associated test files (lib/vancouver/json_rpc.ex, test/vancouver/json_rpc_test.exs). [1] [2] [3] [4]
  • Simplified the send_json function in Vancouver.Method by removing the intermediate json/2 method and directly encoding and sending the response (lib/vancouver/method.ex).

Prompt and Tool Enhancements

  • Added a new CodeReview prompt module to analyze code quality and suggest improvements (lib/vancouver/prompts/code_review.ex).
  • Removed the TestResponse tool, which provided mock responses for testing purposes (lib/vancouver/tools/test_response.ex).

Code Simplification and Validation

  • Refactored Vancouver.Tool to simplify response generation for audio, image, and text responses by consolidating nested maps into single-line maps and adding input validation (lib/vancouver/tool.ex). [1] [2] [3] [4] [5] [6]
  • Improved error handling in Vancouver.Prompt by refining the get_role/1 function to raise more descriptive errors (lib/vancouver/prompt.ex).

Test Coverage Improvements

  • Added new tests for PromptsGet to validate success, error, and "prompt not found" scenarios (test/vancouver/methods/prompts_get_test.exs).
  • Enhanced tests for PromptsList and ToolsList to verify behavior with and without available prompts/tools (test/vancouver/methods/prompts_list_test.exs, test/vancouver/methods/tools_list_test.exs). [1] [2]

@jameslong jameslong self-assigned this Jun 17, 2025
@jameslong jameslong requested a review from Copilot June 17, 2025 22:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modernizes the Vancouver module by renaming JsonRpc2 to JsonRpc, streamlining response-generation functions, removing an obsolete testing tool, adding a new CodeReview prompt, and bolstering test coverage for prompts and tools.

  • Renamed JsonRpc2 to JsonRpc and updated all references.
  • Refactored Vancouver.Tool and Vancouver.Prompt to consolidate response payloads and add guards.
  • Introduced Vancouver.Prompts.CodeReview and expanded tests for prompts_get, prompts_list, and tools_list.
  • Removed the deprecated Vancouver.Tools.TestResponse module.

Reviewed Changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/vancouver/prompt/prompt_test.exs Added comprehensive tests for send_audio/2, send_image/2, and send_text/2.
test/vancouver/plugs/pipeline_test.exs Updated pipeline tests for MCP methods but missing plug invocation and incorrect aliases.
test/vancouver/methods/tools_list_test.exs Extended ToolsList tests to cover empty and non-empty tool lists.
test/vancouver/methods/prompts_list_test.exs Extended PromptsList tests to cover empty and non-empty prompt lists.
test/vancouver/methods/prompts_get_test.exs Added tests for success, invalid-params, and method-not-found in PromptsGet.
test/vancouver/json_rpc_test.exs Renamed module and alias to match JsonRpc.
lib/vancouver/tools/test_response.ex Removed obsolete TestResponse tool module.
lib/vancouver/tool.ex Consolidated content maps into lists, added guards, and updated alias.
lib/vancouver/prompts/code_review.ex Added new prompt module for code review.
lib/vancouver/prompt.ex Updated alias, enhanced get_role/1 error messages, and replaced JsonRpc2.
lib/vancouver/plugs/validate.ex Updated alias from JsonRpc2 to JsonRpc in validate plug.
lib/vancouver/methods/*.ex Updated aliases in all method modules (unknown, tools_list, tools_call, prompts_list, prompts_get, ping, initialize).
lib/vancouver/method.ex Merged JSON response functions, removed json/2, and added halt().
lib/vancouver/json_rpc.ex Renamed JsonRpc2 module to JsonRpc.
Comments suppressed due to low confidence (2)

test/vancouver/plugs/pipeline_test.exs:9

  • The alias Vancouver.PromptTest doesn’t match the actual module (Vancouver.Prompt.PromptTest). Update the alias or remove it and call the imported Vancouver.TestHelpers functions directly.
  alias Vancouver.PromptTest

test/vancouver/plugs/pipeline_test.exs:11

  • The alias Vancouver.ToolTest points to a non-existent module. Either correct it to the real test module or remove it and use the imported Vancouver.TestHelpers helpers.
  alias Vancouver.ToolTest

@jameslong jameslong merged commit f80e396 into main Jun 17, 2025
1 check passed
@jameslong jameslong deleted the tests branch June 17, 2025 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants