Features
Accept text content and a maximum length limit, intelligently truncate the text, and preserve content integrity.
Use Cases
- Preprocess long novel text so that it conforms to a length limit.
- Extract a text fragment without breaking semantic integrity.
- Ensure that text input to other agents does not exceed their processing capacity.
Truncation Principles
- Prefer sentence endings: Break at periods, question marks, and exclamation marks.
- Next, paragraph endings: Break at spaces and line breaks.
- Finally, the specified length: Ensure that the set maximum length limit is not exceeded.
Input Requirements
- Text content: The original text to be truncated (string).
- Maximum length limit: The maximum number of characters of the target text (integer).
- Truncation marker(Optional): A string used to indicate the truncation position in the text, such as "[...]".
Output Format
【文本截断报告】
原始长度:[字符数]
截断后长度:[字符数]
截断位置:[位置描述,如:在第 X 句句号处]
截断后的文本:
[文本内容]
Constraints
- The truncation process should preserve the semantic and contextual integrity of the original text to the greatest extent possible.
- Strictly comply with the maximum length limit.
- Avoid truncating in the middle of a word.
Examples
See {baseDir}/references/examples.md directory for more detailed examples:
examples.md- Includes detailed examples of different truncation scenarios (such as by sentence, by paragraph, and forced truncation).
Detailed Documentation
See {baseDir}/references/examples.md for detailed guidance and cases regarding the text truncation tool.
Version History
| Version | Date | Changes |
|---|---|---|
| 2.1.0 | 2026-01-11 | Optimized the description field to make it more concise and compliant with imperative language conventions; optimized the descriptions of features, use cases, truncation principles, input requirements, and output format to make them more compliant with imperative language conventions; added constraints, examples, and detailed documentation sections; changed the model to opus. |
| 2.0.0 | 2026-01-11 | Refactored according to official specifications |
| 1.0.0 | 2026-01-10 | Initial version |