Repository navigation
Add prompts and resources to fast-time-server - #52
Conversation
Serve prompts and resources alongside the existing tools on both MCP eras,
with 2026-07-28 conformance matching the tools' wire rules:
- Prompts: current_time, convert_time, and server_diagnostics each render a
user message that drives one of the server's own tools, with typed
arguments advertised from the same schema style the tools use.
- Resources: config://timezones, server://info, and server://stats mirror
the timezone rules, the /version endpoint, and the get_stats tool; the
time://now/{timezone} template mirrors get_system_time and /api/time.
- prompts/list, resources/list, and resources/templates/list carry
resultType plus SEP-2549 cache directives (private, ttlMs 0) on the
modern era only; resources/read does the same since nothing the server
returns is cache-safe.
- Hand-route prompts through the SDK router instead of #[prompt_handler],
whose generated list hardcodes CacheScope::Public and would drift from
the existing list_tools behavior.
- Advertise prompts and resources capabilities in initialize and
server/discover.
Loosen the rmcp requirement to any 3.x and float the lockfile to 3.5.0;
replace the deprecated ServerInfo alias with ServerConfig.
Signed-off-by: Jonathan Springer <jps@s390x.com>
lucarlig
left a comment
There was a problem hiding this comment.
Requesting changes for two reproducible correctness issues: RFC 6570 expansion of the advertised timezone template produces URIs the resource reader rejects, and raw prompt-argument interpolation can change the embedded tool arguments or produce invalid JSON. The two inline suggestions address these without adding dependencies. Please include regression tests for template expansion and prompt-argument round trips.
Validation of the reviewed head: all 42 tests, formatting, and strict Clippy passed. A release-build smoke test completed 4,000 requests across eight concurrent clients without failures; this was not a comparison against the base commit.
The suggested replacements were also checked locally: 45 tests and strict Clippy passed after updating the existing template assertion and adding three focused regression checks.
Advertise time://now/{+timezone} (RFC 6570 reserved expansion) so client
expansion of IANA names and fixed offsets produces URIs the reader
accepts, and serialize prompt arguments with json! so quotes, backslashes,
and newlines survive as JSON string values. Add regression tests for
template expansion and prompt-argument round trips.
Signed-off-by: Jonathan Springer <jps@s390x.com>
|
Both review comments are addressed in 4e64527, applying the suggested changes verbatim:
Verified locally: |
lucarlig
left a comment
There was a problem hiding this comment.
Both requested fixes are complete in 4e64527. The advertised {+timezone} template now expands to URIs the reader accepts, and both prompts serialize their argument objects with json!, preserving quotes, backslashes, newlines, braces, and Unicode. The documentation and regression tests were updated.
Rechecked locally: all 45 tests, cargo fmt --check, and strict Clippy passed. Eleven live modern-HTTP checks passed, covering expanded timezone resources and exact argument round trips for both prompts. CI is green. No remaining blocking findings.
Summary
current_time(get_system_time),convert_time(convert_time), andserver_diagnostics(get_stats+verify-protocol), with typed arguments advertised from the same schema style the tools use.config://timezones,server://info(mirrors/version),server://stats(mirrorsget_stats), and thetime://now/{timezone}resource template (mirrorsget_system_time//api/time).resultType: "complete"plus SEP-2549 cache directives (cacheScope: "private",ttlMs: 0) onprompts/list,resources/list,resources/templates/list, andresources/read; all three fields absent on legacy sessions; capabilities advertised ininitializeandserver/discover.PromptRouterinstead of#[prompt_handler], whose generated list hardcodesCacheScope::Publicand would drift from the existinglist_toolsbehavior.RESOURCE_NOT_FOUNDon the legacy era (rewritten to invalid params at 2026-07-28); bad timezones in template reads reuse the tools' exact "Invalid timezone" wording.ServerInfoalias withServerConfig.Testing
cargo test: 42/42 (three new integration tests covering both eras: list results and cache directives, prompts/get argument handling and defaults, resources/read for static/dynamic/template URIs, and error codes)cargo fmt --checkandcargo clippy --all-targets -- -D warnings: clean127.0.0.1:9081: modern-eraprompts/list/resources/list/resources/readover stateless HTTP with SEP-2243 headers (Mcp-Namecarries the prompt name or resource URI), legacy-eraprompts/get/resources/readover an SSE session, REST endpoints unaffectedcargo deny --no-default-features check advisories: ok against the updated lockfile