<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/cutting-tool-output-tokens-in-microsoft-agent-framework-with-toon-qoolbmkzj" -->

---
title: Cutting tool output tokens in Microsoft Agent Framework...
description: Tool call outputs in Microsoft Agent Framework (MAF) are normally JSON-serialized, which bloats context windows with repeated keys, braces and quotes for...
canonical: https://daily.dev/posts/cutting-tool-output-tokens-in-microsoft-agent-framework-with-toon-qoolbmkzj
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Cutting tool output tokens in Microsoft Agent Framework with TOON | daily.dev
og:description: Tool call outputs in Microsoft Agent Framework (MAF) are normally JSON-serialized, which bloats context windows with repeated keys, braces and quotes for...
og:url: https://daily.dev/posts/cutting-tool-output-tokens-in-microsoft-agent-framework-with-toon-qoolbmkzj
og:image: https://api.daily.dev/og/posts/QOoLBMkZj.png
og:image:alt: Cutting tool output tokens in Microsoft Agent Framework with TOON
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Cutting tool output tokens in Microsoft Agent Framework with TOON

**[The Art of Simplicity](https://daily.dev/sources/bartwullems)** · 5 min read · 0 upvotes · 0 comments

## Summary

Tool call outputs in Microsoft Agent Framework (MAF) are normally JSON-serialized, which bloats context windows with repeated keys, braces and quotes for tabular data like order lists. TOON (Token-Oriented Object Notation) offers a line-oriented, YAML/CSV-like encoding that declares field names once for uniform arrays of objects, cutting 30-60% of tokens versus equivalent JSON per the TOON project's benchmarks. Since MAF tools just need to return a string, swapping a tool's return value to a TOON-serialized string (via the Toon.NET NuGet package) works without touching the JSON Schema MAF generates for tool parameters. The gain only matters for tabular, array-of-objects results like order histories or search results; single objects or non-uniform blobs see little benefit. Both MAF and current TOON encoders on NuGet are early/preview software, so pinning versions is advised before production use.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://bartwullems.blogspot.com/2026/09/cutting-tool-output-tokens-in-microsoft.html>

## Questions this post answers

### How can I reduce the token cost of tool call results in the Microsoft Agent Framework?

Serialize tool outputs as TOON (Token-Oriented Object Notation) instead of JSON. Since Microsoft Agent Framework only requires a tool to return a string, a C# method can use a TOON encoder like Toon.NET to serialize the result before returning it, while the JSON Schema for input parameters stays unchanged. TOON works best on uniform arrays of objects, such as order lists or logs, cutting 30-60% of tokens compared to equivalent JSON.

_daily.dev surfaces practical tricks like this for developers optimizing LLM agent token costs._

### When does using TOON instead of JSON for LLM tool output not help?

TOON's token savings come from tabular uniformity, so it barely helps for a single object or a small non-uniform blob, where the encoding is close to compact JSON anyway. In those cases plain JSON is simpler to debug and adding a TOON dependency provides little real gain. TOON is best reserved for tools returning lists like order histories, search results, or log entries.

_Developers weighing data-format tradeoffs for LLM tooling can track patterns like this through daily.dev._

## Similar posts on daily.dev

- [Introduction to TOON Format in Java](https://daily.dev/posts/introduction-to-toon-format-in-java-nta2gzrtp) · Baeldung · 4 upvotes · 1 comments
- [New Token-Oriented Object Notation \(TOON\) Hopes to Cut LLM Costs by Reducing Token Consumption](https://daily.dev/posts/new-token-oriented-object-notation-toon-hopes-to-cut-llm-costs-by-reducing-token-consumption-ql61xzg14) · InfoQ · 3 upvotes · 0 comments
- [TOON vs. JSON](https://daily.dev/posts/toon-vs-json-94jid25qw) · DigitalOcean Community · 5 upvotes · 1 comments
- [How to use TOON to reduce your token usage by 60%](https://daily.dev/posts/how-to-use-toon-to-reduce-your-token-usage-by-60--gqf0dzkqz) · LogRocket · 2 upvotes · 0 comments

---

Tags: [#llm](https://daily.dev/tags/llm), [#c#](https://daily.dev/tags/c#), [#context-engineering](https://daily.dev/tags/context-engineering)

[View this post on daily.dev](https://daily.dev/posts/cutting-tool-output-tokens-in-microsoft-agent-framework-with-toon-qoolbmkzj)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Cutting tool output tokens in Microsoft Agent Framework with TOON","url":"https://daily.dev/posts/cutting-tool-output-tokens-in-microsoft-agent-framework-with-toon-qoolbmkzj","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/cutting-tool-output-tokens-in-microsoft-agent-framework-with-toon-qoolbmkzj"},"datePublished":"2026-09-07T06:12:27.221Z","dateModified":"2026-09-14T07:08:57.013Z","description":"Tool call outputs in Microsoft Agent Framework (MAF) are normally JSON-serialized, which bloats context windows with repeated keys, braces and quotes for...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8249fdeaf6f7341df0be3e8cc969d049?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8249fdeaf6f7341df0be3e8cc969d049?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"The Art of Simplicity","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"The Art of Simplicity","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/52b68c70636d44f0901ae7cd107c9438","url":"https://daily.dev/sources/bartwullems"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/cutting-tool-output-tokens-in-microsoft-agent-framework-with-toon-qoolbmkzj","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"llm,c#,context-engineering","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"The Art of Simplicity","item":"https://daily.dev/sources/bartwullems"},{"@type":"ListItem","position":3,"name":"Cutting tool output tokens in Microsoft Agent Framework with TOON"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/cutting-tool-output-tokens-in-microsoft-agent-framework-with-toon-qoolbmkzj#faq","mainEntity":[{"@type":"Question","name":"How can I reduce the token cost of tool call results in the Microsoft Agent Framework?","acceptedAnswer":{"@type":"Answer","text":"Serialize tool outputs as TOON (Token-Oriented Object Notation) instead of JSON. Since Microsoft Agent Framework only requires a tool to return a string, a C# method can use a TOON encoder like Toon.NET to serialize the result before returning it, while the JSON Schema for input parameters stays unchanged. TOON works best on uniform arrays of objects, such as order lists or logs, cutting 30-60% of tokens compared to equivalent JSON. daily.dev surfaces practical tricks like this for developers optimizing LLM agent token costs."}},{"@type":"Question","name":"When does using TOON instead of JSON for LLM tool output not help?","acceptedAnswer":{"@type":"Answer","text":"TOON's token savings come from tabular uniformity, so it barely helps for a single object or a small non-uniform blob, where the encoding is close to compact JSON anyway. In those cases plain JSON is simpler to debug and adding a TOON dependency provides little real gain. TOON is best reserved for tools returning lists like order histories, search results, or log entries. Developers weighing data-format tradeoffs for LLM tooling can track patterns like this through daily.dev."}}]}
```

