eca icon indicating copy to clipboard operation
eca copied to clipboard

MCP server/tool instructions add a lot of bloat to initial system context even if using "lazy" tool discovery

Open stsquad opened this issue 1 month ago • 6 comments

I noted this with semcode which offers a --lazy flag to reduce the initial context cost of the MCP. It dutifully advertises only:

<deferred-tool name="semcode__call_tool" description="Execute a semcode tool by name with given arguments. Use get_tools first to see the required arguments."/>
<deferred-tool name="semcode__get_tools" description="Get the full schema for tools in a category. Use this to get tool details before calling them."/>
<deferred-tool name="semcode__list_categories" description="List available tool categories. Call this first to discover what semcode can do."/>

as tools but then ECA dump the entire instructions file in the MCP server instructions. Arguably this could be described as semcode's issue (and will prepare a patch for it) however it does raise a bigger question about how ECA approaches managing it's context. There seems to be a variety of approaches that the various agents do from suppressing completely to having their own custom instructions schemas. I thought it would be worth raising this issue to discuss the various context management approaches ECA could take.

To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.

stsquad avatar Oct 30 '26 18:10 stsquad

@stsquad Have you tried mcpSearchTool, doesn't it solve the problem for you?

zikajk avatar Oct 30 '26 18:10 zikajk

  1. @stsquad Have you tried mcpSearchTool, doesn't it solve the problem for you?

I have:

    "mcpToolSearch": {
        "includePattern": [".*"]
    },

but I still see the instructions dumped in the initial prompt.

stsquad avatar Oct 30 '26 18:10 stsquad

Do you know what might be the problem here @ericdallo @rschmukler?

zikajk avatar Oct 30 '26 21:10 zikajk

It might still be beaving "correctly" (as in, as intended) - when I implemented it I decided to have it send a truncated version of the tool description (just the first paragraph, max of 250 characters) even if it was deferred. Can you confirm if the schemas are being omitted?

The full description (if over 1 paragraph) + the tool call schemas are what are deferred. In the MCP servers that I use most frequently this ended up getting rid of a lot of the bloat.

It's a trade-off between making the agent know that it could exist (which pushes it to finding the tool later when it needs it) versus saving context maximally. This was an attempt to strike that balance.

I think we could potentially make it configurable - ie. eca could send truly nothing, just the tool names, or the tool names + truncated descriptions; that being said, at least with my use cases this ended up being the "sweet spot".

rschmukler avatar Oct 30 '26 22:10 rschmukler

I certainly wasn't seeing the truncated description but the whole of instructions which is more than a paragraph. I have submitted a PR on semcodes side which does work.

stsquad avatar Nov 03 '26 10:11 stsquad

I couldn't find anything to improve besides a configurable flag as mentioned, besides that seems like something to be fixed on semcode, LMK if you think we should prioritize the config flag

ericdallo avatar Nov 03 '26 16:11 ericdallo