Repository navigation
The MCP server's tools answer from the catalogue of operations - #2122
Merged
Merged
Conversation
Part of #1684 Each tool called the library's methods itself. Its answers now come from the entries of Core/Operations/Catalogue.cs: Catalogue.Solve.Ask(e, x) where it called e.Solve(x), and so on. Every entry answers exactly what its method answers, so no answer changes, and the 335 tests that drive the server pass as they did. The server's own checks of an answer stay direct calls: differentiating an antiderivative back, reading an input as an integer or a decimal, and the guard before quadrature. Tools.Offers says which entries each tool offers. Tools.OwnComputations lists the six tools whose answer is the server's own computation, such as am_check_steps, each with what it computes. Tools.NotOffered lists the two entries no tool offers, normalize and evaluate, each with the reason. The server's CatalogueTest checks the three against the tool list and the catalogue. An entry added to the catalogue fails it until a tool offers it or NotOffered says why none does. amcli's one-shot commands get the same check, without calling the catalogue: OneShot.offers names the entry each command offers, ownCommands says what info, mcp and help do, and notOffered lists the entries no command offers. Which commands to add is #1019 item 16's question. OneShotTest reads the catalogue's names by reflection, since the terminal is not one of the library's friends. Removing one tool and one entry from the server's lists fails both of its tests and names each, and the same for one command and one entry in the terminal's. The catalogue is internal, so the library names the server in its InternalsVisibleTo. A strong-named assembly may only befriend another one, so the server is signed with the library's key, as the unit tests are, and so is McpUnitTests, which the server befriends. The server ships inside amcli with the library it was built against. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
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.
Part of #1684, the second of two PRs after #2121.
The MCP server's tools answer from the catalogue.
Core/Operations/Catalogue.cs:Catalogue.Solve.Ask(e, x)where it callede.Solve(x), and so on.What each tool offers is declared, and tested.
Tools.Offersnames the entries each tool offers.Tools.OwnComputationslists the six tools whose answer is the server's own computation, such asam_check_stepsandam_eigenvalues, each with what it computes.Tools.NotOfferedlists the two entries no tool offers, each with the reason:normalize, sinceam_simplifyoffers the whole simplification;evaluate, sinceam_evaluatekeeps exact values exact.McpUnitTests/CatalogueTestchecks the three lists against the tool list and the catalogue. An entry added to the catalogue fails the test until a tool offers it, orNotOfferedsays why none does.amcli's commands get the same check, without calling the catalogue.OneShot.offersnames the entry each command offers.ownCommandssays whatinfo,mcpandhelpdo.notOfferedlists the entries no command offers. Which commands to add is Pending breakages: changes agreed or arguable that cannot ship before a major version #1019 item 16's question.OneShotTestreads the catalogue's names by reflection, since the terminal is not one of the library's friends.Signing.
AngouriMath.Mcpin itsInternalsVisibleTo.key.snk, asUnitTestsalready is. So isMcpUnitTests, which the server befriends.amcliwith the library it was built against, so it never meets another version's internals.Checked:
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura