Release: v2.0.0 — cmlapi SDK migration #17
Merged
Merged
Conversation
- Add API v2 function modules (registry, projects, runtimes, quotas, etc.) - Wire tools in stdio_server and http_server - create_registered_model: parse tags JSON string for API array payload - README: tool inventory, create_registered_model tags note, inference_test.py - tests: pytest-asyncio for FastMCP client tests; test_create_registered_model - Fix clone path in README (CAI_Workbench_MCP_Server) Made-with: Cursor
Made-with: Cursor
Paginate project lookup and send project file paths as URL segments so agents can operate outside the first page and nested directories without unsafe deletes. Co-authored-by: Cursor <cursoragent@cursor.com>
Expose the internal project pagination page size and fetched page count so MCP users can see that list_projects exhausted paginated results. Co-authored-by: Cursor <cursoragent@cursor.com>
- Fix URL paths: use :restart/:stop instead of /restart//stop for
restart_application, stop_application, stop_job_run
- Rewrite stop_model_deployment with correct path structure
(models/{id}/builds/{id}/deployments/{id}:stop) and required params
- Rewrite log_experiment_run_batch and delete_experiment_run_batch with
correct :logbatch/:deletebatch paths and run_id parameter
- Make create_application subdomain optional; auto-generate from name
- Remove get_runtimes_tool (broken, no pagination); improve
list_runtimes_tool description to guide agents toward enabled runtimes
- HTTP server tools/list now dynamically exposes all registered tools
via FastMCP instead of hardcoded 6; tools/call falls through to
FastMCP for tools not in legacy dict
- Update tests for 104 tool count and list_runtimes_tool references
…-54632 fix: resolve customer-reported MCP tool failures (DSE-54632)
Migrate 6 high-priority functions (delete/stop/restart/update/create_application, get_runtimes) from hand-rolled requests to cmlapi.CMLServiceApi. Add shared setup_client() to http_helpers.py. Fixes silent failures on delete, wrong URL patterns for stop/restart, and incorrect field names in get_runtimes. - Reduces ~676 lines of boilerplate to ~246 lines of typed SDK calls - Errors now properly surfaced via ApiException instead of silent success - upload_folder.py updated to reuse shared setup_client - Test assertions updated to accept cmlapi as valid HTTP transport
…m cmlapi cmlapi SDK returns datetime objects in responses which break JSON serialization in the MCP transport layer. Add serialize_result() to http_helpers that round-trips through json.dumps(default=str). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace hand-rolled requests calls with cmlapi.CMLServiceApi methods across all function files. Adds setup_client() and serialize_result() to http_helpers.py as shared infrastructure. Key changes: - All tools now use typed SDK calls instead of manual URL construction - serialize_result() handles datetime serialization from SDK responses - create_registered_model uses CreateRegisteredModelRequest + Tag objects - list_project_files passes path as required positional arg - stdio_server.py: fix 4 tools returning dicts instead of JSON strings - Tests updated to mock cmlapi instead of requests - README updated with architecture note and cmlapi prerequisite - .gitignore: add .mcp.json (contains local credentials) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace TOOL_IMPLEMENTATIONS lambda dict with proper @mcp.tool() decorated functions so all tools appear in FastMCP tools/list. Previously only 58 of 104 tools were discoverable. Also fixes: - create_registered_model: handle both dict and plain string tags - test assertions updated for CreateRegisteredModelRequest object - list_project_files test: path is positional arg Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move cmlapi imports behind try/except (ApiException falls back to Exception) and inside function bodies (setup_client, create_registered_model). This allows the package to import and tests to collect without cmlapi installed — required for GitHub Actions CI where cmlapi is unavailable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When cmlapi is unavailable, ApiException = Exception was too broad — it caught ModuleNotFoundError from setup_client() and then crashed accessing e.status. Fix: define a placeholder ApiException class that only matches itself, so real errors fall through to except Exception. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Apiv2 cmlapi methods
Co-Authored-By: Claude Opus 4.6 (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.
Summary
Replace all hand-rolled
requestsHTTP calls with the officialcmlapiPython SDK across all 98 toolfunctions. Fixes customer-reported silent failures, registers all tools in both servers.
What's new
cmlapi SDK migration (
cmlapi.CMLServiceApimethods via a sharedsetup_client()factoryserialize_result()helper handles datetime objects from SDK responsescreate_registered_modeluses typedCreateRegisteredModelRequestandcmlapi.Tagobjects (rawdicts fail for this endpoint)
try/except ImportErroron allcmlapiimports — server starts and CI tests pass without cmlapiinstalled; errors surface at call time with a clear message
Customer bug fixes
delete_application— previously returned{"success": true}even when the API rejected the request;now surfaces the actual error
stop_application/restart_application— previously hit wrong endpoints; SDK uses correct pathsupdate_application—scriptand other fields silently dropped; now all fields passed via SDKget_runtimes— returned wrong field names (image_type,short_description); now returns correctSDK fields (
editor,kernel,full_version)list_project_files—pathpassed as positional arg (SDK requires it)get_project_id— pagination metadata (count,pages_fetched) now reportedHTTP server parity (commit 597de41)
@mcp.tool()— previously only 58 were discoverable viatools/listTOOL_IMPLEMENTATIONSlambda dict/mcp-apiand/debug/calluse FastMCP native tool dispatchOther
stdio_server.py— 4 tool wrappers (create_job,list_jobs,delete_job,delete_all_jobs) fixedto return
json.dumps()instead of raw dictscreate_registered_model_tooldocstring documentstagsJSON format.gitignore— added.mcp.jsoncmlapiprerequisite, updated troubleshootingpyproject.toml— version bumped to2.0.0Testing