Agentโ™ฅ๏ธŽAge
Catalog

io.github.MukundaKatta/promptbudget-mcp

Official

by MukundaKatta ยท JavaScript

Token-budget-aware text handling: count, truncate, and chunk for LLM prompts.

io.github.MukundaKatta/promptbudget-mcp (MCP Server)

Token-budget-aware text handling for LLM prompts. The server provides tools to count tokens, truncate text to a specified token budget, and chunk long content so it can be fed into a model. It is intended for preparing LLM context, fitting chat history, or processing long source documents through a prompt.

๐Ÿ› ๏ธ Key Features

  • Token pre-flight counting via count_tokens(text, max_tokens?, chars_per_token?)
  • Optional max_tokens support returning fits and overflow_tokens
  • Token-budget truncation via truncate_to_token_budget(text, max_tokens, strategy?, ...)
  • Truncation strategies: head, tail, head_tail, smart_cut
  • Budget-aware chunking via chunk_to_budget(text, max_tokens, ...)

๐Ÿš€ Use Cases

  • Preparing LLM context
  • Fitting chat history within a token budget
  • Feeding long source documents through a prompt

โšก Developer Benefits

  • Helps enforce prompt size constraints using tokens, fits, and overflow_tokens
  • Supports multiple truncation strategies for different content-retention needs

โš ๏ธ Limitations

  • Functionality is limited to token-budget-related text handling (counting, truncation, chunking).