MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / _limit_source_label

Function _limit_source_label

src/codegraphcontext/server.py:106–115  ·  view source on GitHub ↗

Human-readable description of which config key produced *effective*.

(max_tokens: int, max_chars_direct: int, effective: int)

Source from the content-addressed store, hash-verified

104
105
106def _limit_source_label(max_tokens: int, max_chars_direct: int, effective: int) -> str:
107 """Human-readable description of which config key produced *effective*."""
108 token_chars = max_tokens * _CHARS_PER_TOKEN
109 both_active = token_chars > 0 and max_chars_direct > 0
110 if both_active:
111 winner = "MAX_TOOL_RESPONSE_TOKENS" if token_chars <= max_chars_direct else "MAX_PROMPT_CHARS"
112 return f"{winner} ({effective} chars)"
113 if token_chars > 0:
114 return f"MAX_TOOL_RESPONSE_TOKENS ({max_tokens} tokens → {effective} chars)"
115 return f"MAX_PROMPT_CHARS ({effective} chars)"
116
117
118def _apply_response_token_limit(tool_name: str, text: str) -> str:

Callers 5

test_only_token_limitMethod · 0.90
test_only_char_limitMethod · 0.90

Calls

no outgoing calls

Tested by 4

test_only_token_limitMethod · 0.72
test_only_char_limitMethod · 0.72