Expose enableConfigDiscovery in all SDK languages#1044
Conversation
Add enableConfigDiscovery option to session config types in Node.js, Python, Go, and .NET SDKs. When set to true, the runtime automatically discovers MCP server configurations (.mcp.json, .vscode/mcp.json) and skill directories from the working directory, merging them with any explicitly provided values (explicit takes precedence on name collision). This surfaces a capability already implemented in copilot-agent-runtime's resolveDiscoveredConfig() for SDK consumers. Changes per SDK: - Node.js: SessionConfig + ResumeSessionConfig pick + client passthrough - Python: create_session/resume_session params + payload serialization - Go: config structs + wire request structs + client passthrough - .NET: config classes + clone constructors + wire records + client passthrough Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR exposes the enableConfigDiscovery session option across the Node.js, Python, Go, and .NET SDKs so consumers can opt into automatic discovery/merging of MCP server configs and skill directories during session.create and session.resume.
Changes:
- Added an optional
enableConfigDiscovery/enable_config_discoverysetting to each SDK’s public session configuration surface. - Plumbed the option through to the JSON-RPC
session.createandsession.resumerequest payloads. - Updated API docs/comments (TS JSDoc, Python docstrings, Go/.NET XML comments) to describe the behavior and interactions with explicit
mcpServers/skillDirectories.
Show a summary per file
| File | Description |
|---|---|
| python/copilot/client.py | Adds enable_config_discovery kwarg to create_session / resume_session and serializes it to enableConfigDiscovery. |
| nodejs/src/types.ts | Adds enableConfigDiscovery?: boolean to SessionConfig and includes it in ResumeSessionConfig. |
| nodejs/src/client.ts | Forwards enableConfigDiscovery in both session.create and session.resume RPC payloads. |
| go/types.go | Adds EnableConfigDiscovery to session config structs and the wire request structs. |
| go/client.go | Forwards EnableConfigDiscovery into create/resume request payloads when enabled. |
| dotnet/src/Types.cs | Adds EnableConfigDiscovery to SessionConfig / ResumeSessionConfig and ensures clone constructors copy it. |
| dotnet/src/Client.cs | Forwards EnableConfigDiscovery in create/resume wire request records. |
Copilot's findings
Comments suppressed due to low confidence (3)
nodejs/src/client.ts:878
- Add/extend tests to verify
enableConfigDiscoveryis forwarded in thesession.resumeRPC payload. Existing tests already capture/inspectsendRequestparams for other forwarded options, but this new field isn’t exercised.
hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
workingDirectory: config.workingDirectory,
configDir: config.configDir,
enableConfigDiscovery: config.enableConfigDiscovery,
streaming: config.streaming,
python/copilot/client.py:1612
- Add a unit test that exercises
enable_config_discoveryand asserts the outgoingsession.resumepayload includesenableConfigDiscovery(mirroring existing forwarding tests for other fields).
if config_dir:
payload["configDir"] = config_dir
if enable_config_discovery is not None:
payload["enableConfigDiscovery"] = enable_config_discovery
dotnet/src/Types.cs:1835
- The clone-copy tests for
ResumeSessionConfigshould be extended to include the newEnableConfigDiscoveryproperty so the new field is covered alongside the other properties verified by clone tests.
DisabledSkills = other.DisabledSkills is not null ? [.. other.DisabledSkills] : null;
DisableResume = other.DisableResume;
EnableConfigDiscovery = other.EnableConfigDiscovery;
ExcludedTools = other.ExcludedTools is not null ? [.. other.ExcludedTools] : null;
- Files reviewed: 7/7 changed files
- Comments generated: 3
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cross-SDK Consistency Review ✅This PR does an excellent job of implementing Implementation Consistency
Minor Documentation Gap (optional follow-up)
Similarly, Overall the cross-SDK implementation is clean and well-done. 👍
|
Motivation
The Copilot runtime already supports
enableConfigDiscoveryin its session create/resume protocol (resolveDiscoveredConfig()insrc/core/server.ts), but none of the SDK languages exposed it. SDK consumers had no way to opt into automatic discovery of MCP servers and skill directories from the working directory.Approach
Added
enableConfigDiscoveryas an optional boolean to session config types across all four SDKs, following the same patterns used by neighboring options likeconfigDir. The property is passed through to the runtime on bothsession.createandsession.resumeRPC calls.Per SDK:
SessionConfiginterface, included inResumeSessionConfigpick type, passed in bothcreateSessionandresumeSessionenable_config_discoveryparameter tocreate_session()andresume_session()with docstrings and payload serializationSessionConfig,ResumeSessionConfig, both wire request structs, and passthrough inCreateSession/ResumeSessionWithOptionsSessionConfig,ResumeSessionConfig(properties + clone constructors), both wire request records, and passthrough in create/resumeWhat it does
When
enableConfigDiscoveryistrue, the runtime scans the working directory for:.mcp.json,.vscode/mcp.json, etc.)Discovered values are merged with any explicitly provided
mcpServersandskillDirectories, with explicit values taking precedence on name collision.Validation
tsc --noEmit)go build ./...,go vet ./...)