Signal Receivers

Django Signal Receivers for mcpclient.

Note

Experimental. The MCPClient 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.mcpclient.receivers.handle_mcpclient_connected(sender, mcpclient, catalog, **kwargs)[source]

Log a successful connection to an MCP server.

Parameters:
  • sender – The signal’s sender.

  • mcpclient (MCPClient) – The MCPClient.

  • catalog – The server’s catalog: its name, version, protocol version and tools.

smarter.apps.mcpclient.receivers.handle_mcpclient_connection_failed(sender, mcpclient, error, **kwargs)[source]

Log a failed connection to an MCP server, as a warning.

Parameters:
  • sender – The signal’s sender.

  • mcpclient (MCPClient) – The MCPClient.

  • error (str) – The error.

smarter.apps.mcpclient.receivers.handle_mcpclient_resource_read(sender, mcpclient, uri, characters, cached=False, **kwargs)[source]

Log a resource read, without its content.

Parameters:
  • sender – The signal’s sender.

  • mcpclient (MCPClient) – The MCPClient.

  • uri (str) – The resource’s URI.

  • characters (int) – The length of the resource’s content.

  • cached (bool) – True if the content came from the cache.

smarter.apps.mcpclient.receivers.handle_mcpclient_tool_called(sender, mcpclient, tool_name, arguments, **kwargs)[source]

Log a tool call.

The arguments are not logged, because they may contain user data.

smarter.apps.mcpclient.receivers.handle_mcpclient_tool_failed(sender, mcpclient, tool_name, error, **kwargs)[source]

Log a failed tool call, as a warning.

Parameters:
  • sender – The signal’s sender.

  • mcpclient (MCPClient) – The MCPClient.

  • tool_name (str) – The tool’s name.

  • error (str) – The error.

smarter.apps.mcpclient.receivers.handle_mcpclient_tool_responded(sender, mcpclient, tool_name, is_error, characters, cached=False, **kwargs)[source]

Log a tool’s result, without its content.

Parameters:
  • sender – The signal’s sender.

  • mcpclient (MCPClient) – The MCPClient.

  • tool_name (str) – The tool’s name.

  • is_error (bool) – True if the tool reported an error.

  • characters (int) – The length of the result.

  • cached (bool) – True if the result came from the cache.

smarter.apps.mcpclient.receivers.mcpclient_deleted(sender, instance, **kwargs)[source]

Log the MCPClient, and invalidate its cached catalog.

Parameters:
  • sender – The model class.

  • instance (MCPClient) – The MCPClient being deleted.

smarter.apps.mcpclient.receivers.mcpclient_saved(sender, instance, created, **kwargs)[source]

Log the MCPClient’s name and id, and refresh its catalog once the transaction commits.

Its serialized fields are not logged: they include the owner’s user profile, whose email address is personal data. Status updates are made with queryset updates, which do not send post_save, so this runs only when the MCPClient’s configuration is saved.