Finalized Roots list changed handling and initial request. Final fit and finish work.
* Updated architecture.md
- Added links to other docs
- Refactor/extracted sections into extension.md, features.md, how-it-works.md, startup.md, and structure.md
* Removed everything.ts
- all features are ported
* In roots.ts
- refactor/renaned setRootsListChangedHandler to syncRoots
- refactor handler logic to requestRoots function
- Calls for roots list directly to get initial list
* In server/index.ts
- import setRootsListChangedHandler
- in clientConnected callback
- call setRootsListChangedHandler passing server and sessionId
* In sse.ts, stdio.ts, and streamableHttp.ts
- update inline and function docs
* In index.ts,
- updated usage output
* In server/index.ts
- refactor/extracted readInstructions to resources/index.ts
- defined ServerFactoryResponse response type
Adding Trigger Elicitation Request and Get Roots List tools
* Updated architecture.md
* Added roots.ts
- tracks roots by sessionId
- setRootsListChangedHandler
- listens for roots changed notification from the client
- updates the roots map by sessionId
- sends log notification or error to the client
* In server/index.ts
- import setRootsListChangedHandler
- in clientConnected callback
- call setRootsListChangedHandler passing server and sessionId
* In sse.ts, stdio.ts, and streamableHttp.ts
- receive clientConnected from server factory
- call clientConnected when server is connected to transport
* Added get-roots-list.ts
- registerGetRootsListTool
- Registers the 'get-roots-list' tool with the given MCP server.
* Added trigger-elicitation-request.ts
- registerTriggerElicitationRequestTool
- registered tool sends an elicitation request that exercises all supported field types
* In tools/index.ts
- imports registerTriggerElicitationRequestTool and registerGetRootsListTool
- in registerTools
- call registerTriggerElicitationRequestTool and registerGetRootsListTool, passing server
Adding Trigger Elicitation Request and Get Roots List tools
* Updated architecture.md
* Added roots.ts
- tracks roots by sessionId
- setRootsListChangedHandler
- listens for roots changed notification from the client
- updates the roots map by sessionId
- sends log notification or error to the client
* In server/index.ts
- import setRootsListChangedHandler
- in clientConnected callback
- call setRootsListChangedHandler passing server and sessionId
* In sse.ts, stdio.ts, and streamableHttp.ts
- receive clientConnected from server factory
- call clientConnected when server is connected to transport
* Added get-roots-list.ts
- registerGetRootsListTool
- Registers the 'get-roots-list' tool with the given MCP server.
* Added trigger-elicitation-request.ts
- registerTriggerElicitationRequestTool
- registered tool sends an elicitation request that exercises all supported field types
* In tools/index.ts
- imports registerTriggerElicitationRequestTool and registerGetRootsListTool
- in registerTools
- call registerTriggerElicitationRequestTool and registerGetRootsListTool, passing server
* Updated architecture.md
* Refactor/renamed get-sampling-request.ts to trigger-sampling-request.ts
- use trigger instead of get throughout
* In tools/index.ts
- sorted display order
[WIP] Adding Gzip File as Resource tool
* Updated architecture.md
* Added gzip-file-as-resource.ts
- imports getSessionResourceURI and registerSessionResource from session.ts
- exports registerGZipFileAsResourceTool
- the registered tool
- validates the input URI
- fetches the file safely
- compresses it
- creates and registers the resource
- returns resource or resource link
* In tools/index.ts
- import registerGZipFileAsResourceTool
- in registerTools,
- call registerGZipFileAsResourceTool passing server
* Added resources/session.ts
- getSessionResourceURI gets a uri to the specified name
- registerSessionResource registers the session-scoped resource and returns a resource link
[WIP] Adding Gzip File as Resource tool
* Updated architecture.md
* In resources/files.ts
- remove 'Docs: ' from resource name
* In resources/templates.ts
- use blob instead of text in resource content
* fix(filesystem): return string in structuredContent to match outputSchema
The directory_tree, move_file, and list_directory_with_sizes tools were
returning an array in structuredContent.content, but outputSchema declares
content as z.string(). This caused MCP error -32602 validation failures.
Changed structuredContent from { content: [contentBlock] } to { content: text }
to match the declared outputSchema and be consistent with other filesystem
tools like list_directory and search_files.
Fixes#3110, #3106, #3093🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test(filesystem): add integration tests for structuredContent schema compliance
Adds tests to verify that directory_tree, list_directory_with_sizes, and
move_file tools return structuredContent.content as a string (matching
outputSchema) rather than an array.
These tests prevent regression of issues #3110, #3106, #3093.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: adam jones <domdomegg+git@gmail.com>
For tools where we seek to get some response from the server, renamed as an action, e.g., "Get Sum" rather than "Add" or "Get Annotated Message" rather than "Annotated Message", so that it's clear what the intent of the tool is in a quick review.
* Updated architecture.md
* Refactor/renamed add.ts to get-sum.ts
* Refactor/renamed annotated-message.ts to get-annotated-message.ts
* In tools/index.ts
- sorted presentation order
Adding get-structured-content tool
* Updated architecture.md
* added get-structured-content.ts
- Registers the 'get-structured-content' tool with the provided McpServer instance.
- The registered tool processes incoming arguments using a predefined input schema,
generates structured content with weather information including temperature,
conditions, and humidity, and returns both backward-compatible content blocks
and structured content in the response.
Adding the get-resource-reference and get-resource-reference tools
* Updated architecture.md
* Added get-resource-links.ts
- Registers the 'get-resource-reference' tool with the provided McpServer instance.
- The registered tool retrieves a specified number of resource links and their metadata.
* In get-resource-reference.ts
- fixed tool description
* In tools/index.ts
- import registerGetResourceLinksTool
- in registerTool
- call registerGetResourceLinksTool
Adding the get-resource-reference tool
* Updated architecture.md
* In prompts/resource.ts
- Refactor/extracted the prompt argument completers into exported functions in resources/templates.ts
- Refactor/extracted BLOB_TYPE, TEXT_TYPE, and resourceTypes into exported constants in resources/templates.ts as RESOURCE_TYPE_BLOB, RESOURCE_TYPE_TEXT, and RESOURCE_TYPES
- In resources/templates.ts
- refactor renamed index to resourceId throughout for consistency with prompts and tool references
* Added tools/get-resource-reference.ts
- Registers the 'get-resource-reference' tool with the provided McpServer instance.
- uses enum and number schema for tools to provide resourceType and resourceId arguments. Completables don't work for tool arguments.
- Returns the corresponding dynamic resource
* In tools/index.ts
- imported registerGetResourceReferenceTool
- in registerTools
- called registerGetResourceReferenceTool