Search Tools
The public tools that search the index: search_documentation, search_code and search_blog.
Each tool validates its arguments, calls smarter.apps.mcpserver.services.search, and formats
the hits as Markdown, with links that the LLM can cite. They are served at the MCPServer’s public
endpoint (smarter.apps.mcpserver.protocol.public). search_blog has no repository
argument, and only the endpoint of every repository serves it. Every tool is read-only, so
call() caches its results until an
index changes.
Note
Experimental. The MCPServer was designed and coded by Claude Code (Anthropic’s Claude Opus 5.5), with Lawrence McDaniel as co-author. It is experimental, and will be documented.
- class smarter.apps.mcpserver.protocol.tools.search.SearchArguments(**data)[source]
Bases:
PublicToolArgumentsThe arguments of search_documentation and search_blog, and the base of those of search_code.
- model_config = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class smarter.apps.mcpserver.protocol.tools.search.SearchBlogTool(scope, github_token=None)[source]
Bases:
PublicToolThe
search_blogtool: ranked passages of the blog’s posts, with links to them.- arguments_model
alias of
SearchArguments
- description: ClassVar[str] = "Search the posts of The Smarter Project's blog, blog.smarter.sh: release announcements, with what changed in each version and how to upgrade, and articles about how and why Smarter was built, e.g. its security, logging, testing, caching and use of AI coding agents. Returns the best passages, with links to the posts. Use it, together with search_documentation, for why and how questions, design decisions, what changed in a release, and the project's history."
What the tool does, and when to call it.
The LLM reads it to decide which tool to call.
- static format_hit(number, hit)[source]
Return one hit, as Markdown: a numbered heading, the post’s url, and its passage in a code block.
- project_wide: ClassVar[bool] = True
Whether only the public endpoint of every repository serves the tool.
- run(arguments)[source]
Search the blog’s posts, with
search_blog().Side effects: database queries, and, if the blog is not indexed yet, a Celery task queued to index it.
- Parameters:
arguments (
PublicToolArguments) – The validated arguments, aSearchArguments.- Return type:
- Returns:
The hits, best first, as Markdown, or a message that nothing matches.
- Raises:
SmarterMCPServerServiceError – If the blog is not indexed yet.
- class smarter.apps.mcpserver.protocol.tools.search.SearchCodeArguments(**data)[source]
Bases:
SearchArgumentsThe arguments of search_code: those of search_documentation, and a folder to search under.
- model_config = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class smarter.apps.mcpserver.protocol.tools.search.SearchCodeTool(scope, github_token=None)[source]
Bases:
SearchToolThe
search_codetool: ranked files of the repositories’ source code, with their matching lines.- arguments_model
alias of
SearchCodeArguments
- description: ClassVar[str] = 'Search the source code and configuration of The Smarter Project: Python, TypeScript, Go, YAML manifests, Helm charts, Terraform and more. Returns the best files, with their matching lines and GitHub links. Use it for how something is implemented, and to find a class, function, setting or manifest field by name.'
What the tool does, and when to call it.
The LLM reads it to decide which tool to call.
- noun = 'code'
What the tool’s results call the files, e.g.
documentationorcode.
- search(arguments, repositories)[source]
Search the code, under the folder that the arguments name, if any, with
search_code().- Parameters:
arguments (
SearchArguments) – The validated arguments, aSearchCodeArguments.repositories (
Sequence[ProjectRepository]) – The repositories to search.
- Return type:
- Returns:
The hits, and the repositories that were not searched.
- class smarter.apps.mcpserver.protocol.tools.search.SearchDocumentationTool(scope, github_token=None)[source]
Bases:
SearchToolThe
search_documentationtool: ranked passages of the repositories’ documentation.- arguments_model
alias of
SearchArguments
- description: ClassVar[str] = 'Search the documentation of The Smarter Project: the Sphinx documentation published at docs.smarter.sh, READMEs, and other reStructuredText and Markdown files. Returns the best passages, with links to the published page and to the source. Use it for concepts, features, configuration, installation and how-to questions.'
What the tool does, and when to call it.
The LLM reads it to decide which tool to call.
- name: ClassVar[str] = 'search_documentation'
The tool’s name, which the LLM calls it by, e.g.
search_code.
- noun = 'documentation'
What the tool’s results call the files, e.g.
documentationorcode.
- search(arguments, repositories)[source]
Search the documentation, with
search_documentation().- Parameters:
arguments (
SearchArguments) – The validated arguments.repositories (
Sequence[ProjectRepository]) – The repositories to search.
- Return type:
- Returns:
The hits, and the repositories that were not searched.
- class smarter.apps.mcpserver.protocol.tools.search.SearchTool(scope, github_token=None)[source]
Bases:
PublicToolThe base class of the search tools of the repositories,
search_documentationandsearch_code.A subclass sets the noun that its results call the files, and implements
search().- format_hit(number, hit)[source]
Return one hit, as Markdown: a numbered heading, its links, and its lines in a code block.
- noun = ''
What the tool’s results call the files, e.g.
documentationorcode.
- run(arguments)[source]
Search the named repository, or every repository of the scope, and return the hits as Markdown.
A repository that is not indexed yet is queued for indexing, and named in a note after the results.
Side effects: see
search_repositories().- Parameters:
arguments (
PublicToolArguments) – The validated arguments.- Return type:
- Returns:
The hits, best first, as Markdown, or a message that nothing matches.
- Raises:
SmarterMCPServerToolError – If the repository is not one of the scope’s.
SmarterMCPServerServiceError – If no repository to search is indexed yet.
- abstractmethod search(arguments, repositories)[source]
Search the repositories.
- Parameters:
arguments (
SearchArguments) – The validated arguments.repositories (
Sequence[ProjectRepository]) – The repositories to search.
- Return type:
- Returns:
The hits, and the repositories that were not searched.