Skip to main content

Logit Processor -- MCP Tool Specification

Version: v1.1.9 | Status: Active | Last Updated: March 2026

Overview​

This document defines the MCP tools exposed by the logit_processor module. These tools are auto-discovered by the PAI MCP bridge via the @mcp_tool decorator in mcp_tools.py and surfaced as part of the ~303 dynamic tools available to Claude.

Auto-Discovery​

PropertyValue
Discovery method@mcp_tool decorator scan
Namespacelogit_processor
Trust defaultSafe
PAI bridgesrc/codomyrmex/agents/pai/mcp/

Tool Reference​

process_logits​

Description: Apply sampling strategies to language model logits. Trust Level: Safe Category: analysis

Parameters:

ParameterTypeRequiredDefaultDescription
logitslist[float]Yes--Raw logit values from language model
temperaturefloatNo1.0Scaling factor (above 1 is diverse, below 1 is focused, and 1 is unchanged)
top_kintNo0Keep only top-k tokens (0=disabled)
top_pfloatNo1.0Nucleus sampling threshold (1.0=disabled)
repetition_penaltyfloatNo1.0Penalize repeated tokens (1.0=disabled, >1.0=penalize)
previous_tokenslist[int] or NoneNoNonePreviously generated token IDs for repetition penalty
seedint or NoneNoNoneRandom seed for reproducibility

Returns: dict -- Dictionary with sampled_token, greedy_token, top5_tokens (list of mappings with id and prob), and entropy.

Example:

from codomyrmex.logit_processor.mcp_tools import process_logits

result = process_logits(
logits=[2.0, 1.0, 0.5, -1.0, 3.0],
temperature=0.8,
top_k=3,
seed=42,
)

Integration Notes​

  • Auto-discovered: Yes (via @mcp_tool in mcp_tools.py)
  • Trust Gateway: All tools are safe -- no destructive operations
  • PAI Phases: BUILD (token sampling), VERIFY (sampling distribution analysis)
  • Dependencies: Requires numpy and internal processor module