Measuring the Token Cost of MCP Tool Definitions

The article examines the token cost of tool definitions in Multimodal Conversational Platforms (MCPs), finding that they can consume thousands of tokens before the model even reads a user message. It provides a tool to audit and optimize tool schemas.

💡

Why it matters

Optimizing tool definitions is crucial for maximizing the efficiency and cost-effectiveness of Multimodal Conversational Platforms, which are becoming increasingly important in the AI landscape.

Key Points

  • 1Tool definitions in MCPs can consume 22,945 tokens before a single user message
  • 2Format differences between providers (OpenAI, MCP, Google) can add 140 tokens across 20 tools
  • 3A tool to audit and optimize tool schemas can reduce token costs by up to 21%

Details

The article discusses the significant token cost of tool definitions in Multimodal Conversational Platforms (MCPs) like GitHub, Slack, and Brave Search. The author measured the token consumption of 137 tools across 11 popular MCP servers, finding that 22,945 tokens were injected before the model read a single user message. One server (GitHub) accounted for 69% of this. The article provides examples of how a simple function can cost 60 tokens, and how that adds up quickly with 20-30 tools. It also shows how the format differences between providers like OpenAI, MCP, and Google can lead to meaningful token differences. To address this, the author introduces a tool called 'agent-friend' that can audit tool schemas, identify optimization opportunities, and reduce token costs by up to 21% through techniques like removing verbose prefixes, trimming long descriptions, and eliminating redundant parameter information.

Like
Save
Read original
Cached
Comments
?

No comments yet

Be the first to comment

AI Curator - Daily AI News Curation

AI Curator

Your AI news assistant

Ask me anything about AI

I can help you understand AI news, trends, and technologies