Repository navigation
M3: resources, prompts, completion, caching and the client counterparts - #4
Merged
Merged
Conversation
Server: Register-McpResource serves fixed content, files, handlers and
RFC 6570 resource templates (levels 1 to 3, variables bound to handler
parameters), and directories as <base>/{+path} templates that reject
'..', absolute paths and symbolic links leading outside. resources/read
answers unknown URIs with -32602 and data.uri (SEP-2164) and carries
per-resource caching hints. Register-McpPrompt derives prompt arguments
from the handler's parameters; prompts/get validates them and shapes
strings, content blocks and New-McpPromptMessage into messages.
completion/complete serves -Completion value lists, handlers and
ValidateSet values, capped at 100 with total and hasMore. The resources,
prompts and completions capabilities are declared only when something is
registered (-32601 otherwise); list cursors are bound to their list.
Core: handler descriptors, parameter binding and invocation are shared by
all handler kinds; the worker path dispatches tools, resources, prompts
and completions; handler warning, information and verbose records become
notifications/message when the request asks for them. Icons and content
annotations are validated; New-McpContent takes -Icons and -ResourceMeta.
Script block tools whose names differ only in special characters no
longer share a worker function.
Client: Get-McpResource, Read-McpResource, Get-McpPrompt,
Invoke-McpPrompt and Get-McpCompletion; a per-session cache that reuses
discover, list and resources/read results for their ttlMs; typed content
blocks and resource contents with GetBytes(); format views.
Conformance: fixtures for the resource, prompt, completion and caching
scenarios, whose baseline entries are removed; the fixture client reads
resources and renders prompts when the server declares them. Adds
examples/weather-server.ps1 and docs/concepts/server-primitives.md.
build.ps1 -Bootstrap now reports why a dependency could not be installed
instead of a strict-mode error about the missing Optional key.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ATyZ6eV1KJ8g6koeUnCdcE
-ErrorVariable of Read-McpResource also collects the protocol exceptions caught inside the command, not all of them as ErrorRecords; the Test task runs Pester under Set-StrictMode -Version Latest, where reading FullyQualifiedErrorId from those objects throws. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ATyZ6eV1KJ8g6koeUnCdcE
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
This PR implements milestone M3 (server primitives) from ROADMAP.md. The M3 block of
conformance-baseline.yml(12 server scenarios) is removed with nothing added in its place, and every scenario in it now passes.Server
Register-McpResourcecan serve:-Content), answered in the dispatcher without running user code.-Path <file>).-ScriptBlock/-Command).-Path <dir>), served as the template<base>/{+path}. Paths that escape the directory through.., absolute paths or symbolic links are reported as not found.resources/readerrors: an unknown resource returns-32602withdata.uri(SEP-2164). Each resource can set its own caching hints (-TtlMs,-CacheScope).Register-McpPromptderives arguments from theparam()block (Mandatory, help text, ValidateSet) or takes them from explicit-Arguments. Handler output is shaped into messages: strings, content blocks andNew-McpPromptMessage.completion/completeoffers values from-Completionlists, handlers and ValidateSet, capped at 100 withtotalandhasMore.resources,promptsandcompletionsare declared only when something is registered; otherwise their methods return-32601.tools/listcursor is rejected byprompts/list.Core
Private/Handler.ps1and are shared by all handler kinds.Nameproperty.notifications/message.New-McpContentgets-Icons(resource links) and-ResourceMeta(embedded resources).a-banda_bused to share one worker function; they no longer do.Client
Get-McpResource [-Template],Read-McpResource(pipeline input; ObjectNotFound for-32602withdata.uriand for the legacy-32002),Get-McpPrompt,Invoke-McpPrompt,Get-McpCompletion.resources/readresults. For a multi-page list the shortestttlMsapplies;ttlMs = 0is never cached.GetBytes(), and have format views.Conformance, examples, docs
http-standard-headersgoes from 3 to 9 checks, now includingMcp-Method/Mcp-Nameforresources/readandprompts/get.examples/weather-server.ps1(all primitives, with a stdio integration test) anddocs/concepts/server-primitives.md.docs/conformance.mdanddocs/development.mdare updated.Also fixed:
build.ps1 -Bootstraphid the real install error behind a strict-mode error about the missingOptionalkey.Checklist
./build.ps1 -Task CIpasses locally (Analyze, Test, Package, PublishLocal). Only partly verified. The PowerShell Gallery is blocked by egress policy in the development container, so ModuleBuilder could not be installed andBuild/Package/PublishLocaldid not run. What did run:Analyze:Invoke-Build Analyzewith PSScriptAnalyzer 1.25.0 from the official GitHub release; no findings.Test: Pester 6.2 against a module assembled in the same file order ModuleBuilder uses, on pwsh 7.4.20. 406 passed, 0 failed, 5 skipped.Mcp-Name, 400/-32602), stdio (weather example).CHANGELOG.mdhas an entry under[Unreleased].conformance-baseline.ymlshrank: the M3 block is removed. Server and client legs of the pinned0.2.0-alpha.11exit 0 locally against it.🤖 Generated with Claude Code
https://claude.ai/code/session_01ATyZ6eV1KJ8g6koeUnCdcE
Generated by Claude Code