{"uid":"cap_BemjJXavUfrTAARh9SlQZ","slug":"delx-truncate-middle-075e8104","name":"Delx Truncate Middle","description":"Truncate long text in the middle with an ellipsis. Call when you keep start+end context inside UI/log width limits. Returns truncated text and truncated flag for $0.001 USDC via x402 on Base. No network, no keys, no retention; first-party local JSON only. Results are advisory; the caller owns budgets, auth, and production controls.","url":"https://api.delx.ai/api/v1/x402/truncate-middle","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"text":{"type":"string","description":"Input field: text."},"max_chars":{"type":"integer","description":"Input field: max chars."}}},"responseSchema":{"type":"json","example":{"text":"abcde…vwxyz","schema":"delx/util-truncate-middle/v1","max_chars":11,"truncated":true}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_nR4rjFaFTC4F9-5zlkH6A","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Truncates long text in the middle by replacing the omitted portion with an ellipsis, preserving both the start and end of the string within a specified character limit.","exampleAgentPrompt":"Truncate this long filename 'annual-marketing-report-Q4-2024-final-revised-v3-approved.pdf' to a maximum of 40 characters, keeping both the start and end visible with an ellipsis in the middle.","exampleUseCases":[{"title":"Fit long file paths in UI table","prompt":"I need to display the file path '/home/user/projects/backend/services/payment/handlers/stripe_webhook_handler.py' in a table column that's only 50 characters wide — can you truncate the middle so both the beginning and the file name at the end are still visible?"},{"title":"Shorten log lines for terminal output","prompt":"This log message is too long for our 80-character terminal display: 'ERROR: Failed to connect to database server at postgres://db-prod-cluster-east-1.internal:5432/maindb'. Truncate it to 80 chars keeping the start and end."},{"title":"Display truncated API keys in a dashboard","prompt":"Show the API key 'sk-live-aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890abcdef' in our dashboard label, but truncate the middle to keep it under 30 characters so users can still recognize the prefix and suffix."}],"resultDescription":"Returns the processed text string with the middle portion replaced by an ellipsis (…) so the total length fits within max_chars, plus a boolean flag indicating whether truncation actually occurred. If the input was already within the limit, the text is returned unchanged with the flag set to false.","failureModes":["Missing required 'text' field returns a validation error","Missing or invalid 'max_chars' (non-integer or zero/negative) returns a validation error","max_chars smaller than the ellipsis itself may produce undefined or edge-case output","Payment failure via x402 prevents the call from completing","Very large text inputs may time out or be rejected"],"whenToPreferThis":"Choose this endpoint when you need to preserve both the beginning and end of a string while fitting it into a fixed width — for example, file paths, URLs, identifiers, or log lines where the suffix (like a file extension or error code) is as important as the prefix. Prefer a head-truncation or tail-truncation approach instead when only one end matters. This is a lightweight, stateless local utility requiring no API keys and costing $0.001 USDC per call, ideal for high-frequency formatting tasks inside agent pipelines.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T00:56:59.478Z","isFirstParty":false}