Repository navigation
fix(plugins): read canvas and moodle settings from storage - #967
Merged
abdulrafey1 merged 13 commits intoOct 26, 2026
Merged
Conversation
Canvas tools no longer take api_url or api_token from the model. Each tool loads the calling user's stored Canvas settings and raises PluginNotConfiguredError when none exist. The chat LMS rules no longer branch on configured state and Canvas settings never enter the prompt. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Moodle tools no longer take api_url or api_token from the model. Each tool loads the calling user's stored Moodle settings and raises PluginNotConfiguredError when none exist. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The module checks the stored settings rather than authenticating with model-supplied credentials, and it also holds the LMS vocabulary tool. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
zaira-bibi
requested changes
Oct 26, 2026
The rules text names the page the plugin settings errors name, "Settings". Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Each Canvas tool loaded the stored settings, opened a client and mapped errors itself. Two helpers, _canvas_call and _canvas_list, now do that once; the tools only build the path and payload. CanvasClient.request replaces the private _request_dict and the get/post/put/delete wrappers only the tools used. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A tool raising PluginNotConfiguredError or PluginConfigInvalidError is an expected user state, so the chat tool loop logs one warning line without a traceback. The model sees the same message, the audit trail still records tool.failed, and the failure kind is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
canvas_authenticate and moodle_authenticate take no credentials any more; they check whether the user's stored settings work. They are now canvas_check_settings and moodle_check_settings, in the canvas-settings and moodle-settings tool categories. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The rules told the model to call a "settings-check tool", which matched no tool name. They now name the <lms>_check_settings convention the Canvas and Moodle tools follow. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The loader patch applied to the whole module, so the real-storage test had to patch the real loader back in. The tool test classes now ask for stored_config by name instead. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Canvas no longer puts credentials in the prompt, so asserting its token is absent passed whatever the switch did. The test now checks only that an LMS the user switched off sends none. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
mock_http_session, seed_plugin_settings and tool_input_property_names replace the copies in the Canvas and Moodle tests. The credential tests now read the schemas of the tools each plugin registers, which is what the model sees. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
abdulrafey1
removed this pull request from stack #971
October 26, 2026 13:01
abdulrafey1
added this pull request to stack #999
October 26, 2026 13:02
…-moodle Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
What
Canvas and Moodle tools no longer take an API URL or token from the model. Each tool loads the
calling user's stored settings, so neither LMS's credentials are written into the chat prompt any more.
Changes
AuthenticationPayloadand MoodleAuthare removed from every tool schema.CanvasClientandMoodleClientare built from the stored config.canvas_authenticateandmoodle_authenticatebecomecanvas_check_settingsandmoodle_check_settings(categoriescanvas-settings/moodle-settings). They take no arguments andcheck the stored settings, which is how the model learns whether the LMS is set up.
moodle_list_coursestakes no arguments either._canvas_call, and every list toolthrough
_canvas_list. Each loads the settings, opens the client and maps errors once.CanvasClient.requestreplaces the private_request_dictand theget/post/put/deletewrappers.
PluginNotConfiguredError/PluginConfigInvalidErroras onewarning line without a traceback. The model sees the same message, the audit trail still records
tool.failed, and the failure kind is unchanged.CanvasConfigandMoodleConfigdropto_lms_credentials_hint, so chat stopsappending their credentials to the system prompt.
never ask for credentials; settings live on the Settings page; call the LMS's
<lms>_check_settingstool to learn whether it is set up.
sparkth.lib.testinggainsschema_property_names,tool_input_property_names,mock_http_sessionandseed_plugin_settings, shared by the plugin tests. The Moodlestored-settings fixture is opt-in.
How to Test
uv run pytest sparkth/plugins/canvas sparkth/plugins/moodle sparkth/plugins/chat -v.the stored URL with the stored key. A Canvas URL with a path and a trailing slash is covered.
the Settings page and asks for no credentials.
moodle_check_settingsand reveals nothing.Notes
Breaking for MCP clients: the Canvas and Moodle tool schemas no longer accept
auth. On/ai/mcpno user is bound, so these tools fail with
NoAuthenticatedUser; external MCP clients are out ofscope for now. Canvas tools also stop sending the token in request bodies.
This description was written with the assistance of an LLM (Claude).
🤖 Generated with Claude Code