Skip to content

Commit 4c2cef0

Browse files
theletterfclaudecursoragent
authored
fix(mcp): add missing required fields to document query source filters (#2729)
GetByUrlAsync omitted `search_title` and GetStructureAsync omitted both `search_title` and `type` from the Elasticsearch _source filter. Since DocumentationDocument marks these as `required`, the JSON deserializer threw on every response: "missing required properties including: 'search_title'". Adding them to the source filter fixes the 2 broken document tools. Co-authored-by: Claude <claude@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 935a63c commit 4c2cef0

1 file changed

Lines changed: 32 additions & 29 deletions

File tree

src/api/Elastic.Documentation.Mcp.Remote/Gateways/DocumentGateway.cs

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,25 @@ public class DocumentGateway(
2828
.Indices(clientAccessor.Options.IndexName)
2929
.Query(q => q.Term(t => t.Field(f => f.Url).Value(normalizedUrl)))
3030
.Size(1)
31-
.Source(sf => sf.Filter(f => f.Includes(
32-
e => e.Url,
33-
e => e.Title,
34-
e => e.Type,
35-
e => e.Description,
36-
e => e.NavigationSection,
37-
e => e.Body,
38-
e => e.Parents,
39-
e => e.Headings,
40-
e => e.Links,
41-
e => e.AiShortSummary,
42-
e => e.AiRagOptimizedSummary,
43-
e => e.AiQuestions,
44-
e => e.AiUseCases,
45-
e => e.LastUpdated,
46-
e => e.Product,
47-
e => e.RelatedProducts
48-
))),
31+
.Source(sf => sf.Filter(f => f.Includes(
32+
e => e.Url,
33+
e => e.Title,
34+
e => e.SearchTitle,
35+
e => e.Type,
36+
e => e.Description,
37+
e => e.NavigationSection,
38+
e => e.Body,
39+
e => e.Parents,
40+
e => e.Headings,
41+
e => e.Links,
42+
e => e.AiShortSummary,
43+
e => e.AiRagOptimizedSummary,
44+
e => e.AiQuestions,
45+
e => e.AiUseCases,
46+
e => e.LastUpdated,
47+
e => e.Product,
48+
e => e.RelatedProducts
49+
))),
4950
ct);
5051

5152
if (!response.IsValidResponse || response.Documents.Count == 0)
@@ -106,17 +107,19 @@ public class DocumentGateway(
106107
.Indices(clientAccessor.Options.IndexName)
107108
.Query(q => q.Term(t => t.Field(f => f.Url).Value(normalizedUrl)))
108109
.Size(1)
109-
.Source(sf => sf.Filter(f => f.Includes(
110-
e => e.Url,
111-
e => e.Title,
112-
e => e.Parents,
113-
e => e.Headings,
114-
e => e.Links,
115-
e => e.Body,
116-
e => e.AiShortSummary,
117-
e => e.AiQuestions,
118-
e => e.AiUseCases
119-
))),
110+
.Source(sf => sf.Filter(f => f.Includes(
111+
e => e.Url,
112+
e => e.Title,
113+
e => e.SearchTitle,
114+
e => e.Type,
115+
e => e.Parents,
116+
e => e.Headings,
117+
e => e.Links,
118+
e => e.Body,
119+
e => e.AiShortSummary,
120+
e => e.AiQuestions,
121+
e => e.AiUseCases
122+
))),
120123
ct);
121124

122125
if (!response.IsValidResponse || response.Documents.Count == 0)

0 commit comments

Comments
 (0)