You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -118,6 +117,9 @@ If no new rule is detected -> do not update the file.
118
117
119
118
- Update `README.md` whenever public API shape, setup, or usage changes.
120
119
- Keep the README focused on package usage and onboarding, not internal implementation notes.
120
+
- Document optional DI dependencies explicitly in README examples so consumers know which services they must register themselves, such as embedding generators.
121
+
- Keep README code examples as real example code blocks, not commented-out pseudo-code; if behavior is optional, show it in a separate example instead of commenting lines inside another snippet.
122
+
- Never leave empty placeholder setup blocks in README examples such as `// gateway configuration`; show a concrete minimal configuration that actually demonstrates the API.
121
123
- Keep repo docs and skills in English to stay aligned with MCAF conventions.
122
124
- Keep root packaging metadata centralized in `Directory.Build.props`.
123
125
- Keep package versions centralized in `Directory.Packages.props`.
@@ -141,7 +143,6 @@ If no new rule is detected -> do not update the file.
141
143
- restore
142
144
- build
143
145
- test
144
-
- pack when package output is affected
145
146
146
147
### Code Style
147
148
@@ -151,6 +152,7 @@ If no new rule is detected -> do not update the file.
151
152
- Keep public API names aligned with package identity `ManagedCode.MCPGateway`.
152
153
- Do not duplicate package metadata or version blocks inside project files unless a project-specific override is required.
153
154
- Use constants for stable tool names and protocol-facing identifiers.
155
+
- Never leave stable string literals inline in runtime code; extract named constants for diagnostic codes, messages, modes, keys, and other durable identifiers so changes stay centralized.
154
156
- Keep transport-specific logic inside the gateway and source registration abstractions, not scattered across the codebase.
155
157
- Keep the package dependency surface small and justified.
Copy file name to clipboardExpand all lines: README.md
+54-1Lines changed: 54 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,6 +70,8 @@ var invoke = await gateway.InvokeAsync(new McpGatewayInvokeRequest(
70
70
Query: "managedcode"));
71
71
```
72
72
73
+
`AddManagedCodeMcpGateway(...)` does not create or configure an embedding generator for you. Vector ranking is enabled only when the same DI container also has an `IEmbeddingGenerator<string, Embedding<float>>`. The gateway first tries the keyed registration `McpGatewayServiceKeys.EmbeddingGenerator` and falls back to any regular registration. Otherwise it stays fully functional and uses lexical ranking.
74
+
73
75
## Context-Aware Search And Invoke
74
76
75
77
When the current turn has extra UI, workflow, or chat context, pass it through the request models:
@@ -127,7 +129,58 @@ These tools are useful when another model should first search the gateway catalo
127
129
- required arguments
128
130
- input schema summaries
129
131
130
-
If an embedding generator is registered, the gateway vectorizes those descriptor documents and uses cosine similarity plus a small lexical boost. If no embedding generator is present, it falls back to lexical ranking without disabling execution.
132
+
If an embedding generator is registered, the gateway vectorizes those descriptor documents and uses cosine similarity plus a small lexical boost. It first tries the keyed registration `McpGatewayServiceKeys.EmbeddingGenerator` and then falls back to any regular `IEmbeddingGenerator<string, Embedding<float>>`. If no embedding generator is present, it falls back to lexical ranking without disabling execution.
133
+
134
+
The embedding generator is resolved per gateway operation, so singleton, scoped, and transient DI registrations all work with index builds and search.
135
+
136
+
## Optional Embeddings
137
+
138
+
Register any provider-specific implementation of `IEmbeddingGenerator<string, Embedding<float>>` in the same DI container before building the service provider.
0 commit comments