Signal Receivers
Django signal receivers of the MCPServer app.
They log the MCPServer’s requests and tool calls, and the outcome of each attempt to index a
repository or the blog. One of them also keeps the tool result cache correct: when a repository
is indexed at a new commit, handle_mcpserver_repository_indexed() starts a new index
generation, so that no tool answers from the old files (see
smarter.apps.mcpserver.protocol.caching).
The signals are defined in smarter.apps.mcpserver.signals. The receivers are connected
when smarter.apps.mcpserver.apps.MCPServerConfig.ready() imports this module.
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.
- smarter.apps.mcpserver.receivers.handle_mcpserver_called(sender, server, method, **kwargs)[source]
Log a JSON-RPC request to the MCPServer, at DEBUG.
- smarter.apps.mcpserver.receivers.handle_mcpserver_repository_index_failed(sender, repository, error, **kwargs)[source]
Log a repository, or the blog, that could not be indexed, at WARNING.
The cached tool results are left alone, because the index did not change.
- smarter.apps.mcpserver.receivers.handle_mcpserver_repository_indexed(sender, index, **kwargs)[source]
Make the cached tool results stale, since a repository’s files changed, and log it.
Side effect: a cache write, through
invalidate_cached_tool_results(), which starts a new index generation.- Parameters:
sender – The function that indexed the repository.
index (
RepositoryIndex) – The repository’s index, at its new commit.kwargs – The signal’s other arguments, which are ignored.
- smarter.apps.mcpserver.receivers.handle_mcpserver_tool_called(sender, server, tool_name, arguments, is_error, characters, **kwargs)[source]
Log a call to one of the MCPServer’s tools, with its arguments and the length of its result.
- Parameters:
sender – The class that sent the signal.
server (
str) – The server’s name.tool_name (
str) – The tool’s name, e.g.read_file.arguments (
dict) – The tool’s arguments.is_error (
bool) – Whether the tool returned an error.characters (
int) – The length of the tool’s result.kwargs – The signal’s other arguments, which are ignored.