Sitecore MCP Server: Search, First Iteration

Anton Tishchenko
Anton Tishchenko
Cover Image for Sitecore MCP Server: Search, First Iteration

We have added another chunk of MCP tools. These MCP tools are based on the Indexing Sitecore PowerShell Commands. You can rebuild the index, add or remove items from the index, stop indexing, pause indexing, resume indexing, and most importantly, you can search!

AI agents are not awesome with Find-Item tool as they were with other Sitecore MCP tools. But it is still important to tell the story to have realistic expectations, understand the limitations of AI Agents and MCP to build agentic workflows.

Samples

I take random text from one of the pages and ask Cursor to find the item that contains this text.

Can you find sitecore item that has text "This case study explores how AI-powered solutions revolutionize customer engagement"?

find by text

AI Agent was not able to find this text. And that is kind of expected. There are 835 fields in sitecore_master_index. And, actually it is probably better behavior than iteration thought all these fields. But if I prompt to use Abstract field, the response is successful.

The field name is Abstract

Abstract field name


Now, let's try to find all pages with the template Project Page

Find all items with template Project Page

template name

AI Agent failed to use the right Solr index field for search. There are 25 fields related to templates: datasource_template_t_fr, _templates, item_template_t, footer_template_t_en, datasource_template_t_ja, exclude_templates_sm, comment_template_sm, default_comment_template_sm, header_template_t_en, istemplate_b, _template, _templatename, datasource_template_t, include_templates_sm, template_sm, header_template_t, parameters_template_sm, sitetemplate_sm, footer_template_t, datasource_template_t_zh among 835 total fields. And AI Agent's guess with item_template_t_en was not the worst one, but the right is _templatename.

You used the wrong field for search, you should use _templatename

template name

template name

This time results are much better. All pages were found!


Let’s try a non-text field. How about Boolean type?

Find items that has layout

has layout

Partial success. The AI agent was able to select the right field for search, get the results, but failed in processing them. It returned only 8 results, but we have much more. The number of results is random. First time it was 8, second 74, third 24. But never the full list. I assume that we hit the AI Agent context window. I used Claude with Cursor. Claude has a context window of 200k tokens. The response from the MCP server search tool has 486133 characters, which is about 180k tokens. But also, it may not be the first message in the chat. Context includes the MCP tools description. So, it is most probably the context window problem.

Conclusion

The first iteration of search tools for the Sitecore MCP server is ready. It is not ideal, but we know where the problems are and how to overcome them. The number of fields should be decreased. We will be able to achieve it by splitting one tool into few tools by language and excluding rarely used fields from system templates. The response should be cleaned up and include as little information as possible. Item Name, Item Id, Template Name, Template Id, Path, and fields included in the query should be enough. Stay tuned, the second iteration will be much better!