SEAB-7740 Add slimmed TRS MCP tools - #12
Conversation
Implements the two unauthenticated, parameterless TRS V2 endpoints (service-info and toolClasses), plus a shared camelCase-to-snake_case casing helper for translating their responses into our models. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ckstore Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Adds list_tools, search_tools, get_tool, list_tool_versions, get_tool_version, get_tool_descriptor, get_tool_descriptor_by_path, get_tool_files, get_tool_tests, and get_tool_containerfile to trs.py, backed by Dockstore's TRS V2 endpoints, along with the TRS models they return. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ref comes from DOCKSTORE_MCP_GIT_REF, which the Docker image sets from a GIT_REF build argument (filled in by the tagged deploy workflow and the Makefile), falling back to the package version when unset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
list_tools and search_tools now return a ToolPage with the total across every page and the next page's offset. Dockstore only reports the last page's offset, computed as floor(total / limit), so the total is counted from the last page's contents rather than read from the header. Adds the JUPYTER and SERVICE descriptor types Dockstore's TRS API accepts, so notebooks' descriptors and files can be fetched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With summary set, each tool comes back as a ToolSummary (id, name, organization, class, descriptor languages across its versions, version names, and the first 200 characters of its description) instead of the full TRS record. The nine RNA-seq name searches against production shrink from about 724 KB to 43 KB this way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Monorepo workflows such as broadinstitute/warp have a version for every branch and tag of the repository, so a summary of one ReblockGVCF search was 57 KB, 94% of it version names. Summaries now list at most 10 names, production-ready versions first, plus version_count and versions_truncated so callers know when the list is incomplete. The same search is now 5 KB. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Monorepo workflows list a version for every branch and tag of their repository: broadinstitute/warp's ReblockGVCF has 1,433, a 793 KB response. With summary, each version is just its name, meta_version and is_production, which brings that entry down to 151 KB. Paging through the versions is left to a follow-up ticket, since Dockstore's TRS endpoint ignores limit and offset. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
list_tool_classes only added a little more about the TRS instance, so an agent needed two calls to learn what it was talking to. get_trs_info now fetches service-info and toolClasses concurrently and returns the classes as tool_classes, and list_tool_classes is removed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
get_tool_descriptor, get_tool_tests and get_tool_containerfile each fetch a file that get_tool_files already lists, and get_tool_descriptor_by_path returns the same content for every one of them. Remove the three tools and make relative_path optional, so omitting it still fetches the primary descriptor without waiting on get_tool_files. That leaves 13 tools and trims about 5.8 KB from the tool schemas agents load. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
hello only reported which Dockstore instance the server is attached to and its version, which is what get_trs_info is for. get_trs_info now always reports dockstore_url and server_version, and local_only=True returns just those without contacting Dockstore, keeping hello's use as a smoke test. That leaves 12 tools. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
This comment was generated by Claude (Claude Code). Prompts used to evaluate these tool changes These are the prompts from today's sessions that used the Dockstore MCP ( The table is for the 9-tool head (
Compared with the 17-tool version this PR started from ( |
# Conflicts: # README.md # src/dockstore_mcp/models.py # src/dockstore_mcp/tools/__init__.py # src/dockstore_mcp/tools/trs.py # tests/test_server.py # tests/test_trs.py
get_tool_version takes an optional files descriptor type: given one, it fetches the version and its file listing in parallel and returns them together, so the tool list drops from 12 to 11. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
list_tools takes search_tools' filters: with none it pages through every tool as before. The tool list drops from 11 to 10, and since each tool carried its own copy of the ToolPage output schema, the schemas shrink by about 9 KB. A non-TRS search will come separately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
get_tool takes list_tool_versions' summary option, which shrinks each
version to its name, meta_version, and is_production. Dockstore's
/tools/{id} already returns every version, so this needs no extra
request, and the tool list drops from 10 to 9.
get_tool returns a new ToolDetail, whose versions are either full or
summarized, rather than a union of models, which FastMCP would wrap
under "result". Also export ToolVersionWithFiles from models.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
get_tool_version with files used to fail outright if only the file listing request failed. It now returns the version with files unset and a files_error saying why; a missing version still fails the call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two differed only in whether versions could be summaries. Tool's versions now take either, with left_to_right so that a TRS response always parses as full versions, and get_tool swaps in summaries in place. Responses are byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/health, get_trs_info's server_version, and the version the server reports to MCP clients all used the package version, 0.1.0, so none of them showed which release was running. They now share the User-Agent's Settings.server_version: the git ref the server was built from (the release tag, for published images), else the package version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| ## Tools | ||
|
|
||
| | Tool | Description | | ||
| | ------------------- | ------------------------------------------------------------------------------------- | |
There was a problem hiding this comment.
This is most useful for a breakdown of what the tools are and what they do
| PIP ?= $(VENV)/bin/pip | ||
| IMAGE ?= dockstore/dockstore-mcp:local | ||
| # Reported in the User-Agent the server sends to Dockstore. | ||
| GIT_REF ?= $(shell git describe --tags --always 2>/dev/null) |
There was a problem hiding this comment.
This git ref business is to hook-up the user agent version to the mcp version which we will also expose in Slack deploy messages and the footer
| description: str | None = Field(default=None, description="Longer explanation of what this class is.") | ||
|
|
||
|
|
||
| class TrsDescriptorType(StrEnum): |
There was a problem hiding this comment.
These models are basically just TRS models
| included_apps: list[str] | None = Field(default=None, description="Apps bundled with this version.") | ||
|
|
||
|
|
||
| class ToolVersionSummary(BaseModel): |
There was a problem hiding this comment.
This summary business allows the agent to pick to get lists of versions or tools with fewer fields. The content is still transferred from the webservice to the MCP but not over the Internet to the end user
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
As we discussed, I'm not convinced that TRS is the ideal AI interface for Dockstore. The TRS "tool" terminology isn't consistent with Dockstore's notion of a tool ("CommandLineTool"), and some important information about Dockstore entries isn't accessible via TRS. That said, this streamlined version is better than a literal conversion of the entire TRS API, and it'll give us a something to benchmark and compare against the other in-process implementation.
FWIW, we can/should be making more information accessible via TRS either as official proposals for extension or unofficial extensions. For terminology, I'm not opposed to renaming/describing entities differently as they flow through MCP interface after being retrieved from the TRS API. |
Description
Implements TRS tools but removing all the convenience methods that are useful for humans but redundant for AI.
i.e. we had separate methods for getting container files, tests, and descriptors but they were already implemented as simple file retrieval in the web service
The hello method was redundant with TRS server info command (added a mode to just show that the MCP server was up without talking to the webservice) and also merged the process of getting tool versions with getting a tool controlled through arguments. We end up with 5 total implemented tools.
Generated comment follows:
Trims the MCP server from 17 tools to 9 so agents load less and have fewer overlapping choices. The tool definitions the model sees shrink from 18,267 B to 14,451 B (68,673 B → 50,133 B with output schemas, which Claude Code doesn't pass to the model).
list_tool_classesandhellofold intoget_trs_info, which also reports the Dockstore URL and server version and, withlocal_only=True, skips Dockstore as a smoke test.get_tool_descriptor,get_tool_testsandget_tool_containerfilefold intoget_tool_descriptor_by_path, which fetches the primary descriptor whenrelative_pathis omitted.get_tool_filesfolds intoget_tool_version(files=…),search_toolsintolist_tools(a proper non-TRS search will come separately), andlist_tool_versionsintoget_tool(summary=…).Review Instructions
There's a generated comment below with the prompts that I tested the MCP with, try them and see if the MCP as deployed in QA gives useful/realistic results.
Issue
broadinstitute/warpfrom overflowing an agent's context: summaries cap version names at 10 and addversion_count(aReblockGVCFsearch: 57 KB → 5 KB), and version lists gained a three-fieldsummary(793 KB → 151 KB).summary, notebooks and services, and adockstore-mcp/<git ref>User-Agent.Security and Privacy
None
e.g. Does this change...
Please make sure that you've checked the following before submitting your pull request. Thanks!
make check🤖 Generated with Claude Code