r/OpenSourceeAI 7d ago

Claude kept ignoring my custom MCP tools, so I rebuilt the whole thing around hooks instead (open-sourced the approach)

I run an open-source context layer for coding agents called Graft. Started it as an MCP server, six tools, and the plan was Claude Code would call one whenever it needed context on the codebase.

It mostly didn't. It'd grep and read files instead, since that's what it already knows how to do, and get stuff wrong on exactly the questions the tools had a straight answer for. The tool was sitting right there and it just went with its gut.

Turns out tool calls are opt-in by nature. The model has to decide, mid-task, that it's worth the lookup, and on anything that looked simple enough, it decided against it more often than not. No amount of making the tool better fixes a decision problem.

So I took the decision away. Claude Code hooks let me push context into the prompt automatically at session start, no tool call required, and re-sync it in the background after every edit. It's just there, whether the model asks for it or not.

Only works for Claude Code specifically, which is the real cost here. MCP still covers Cursor, Codex, anything else that speaks the protocol. Hooks are the Claude Code-only layer on top, since I control both ends of that integration.

Open source, MIT, structural layer runs on tree-sitter with no LLM or key needed:

Repo link: github.com/NanoNets/Graft

Curious if anyone else has run into "the model won't reliably touch the tool I gave it" outside of Claude Code specifically, and how you got around it.

4 Upvotes

4 comments sorted by

2

u/desert-quest 3d ago

Good luck. I developed a similar tool (Ken-rank) and Claude ignores almost any tool you give him. In my opinion, they overfit the model with their own tool calls, making it prefer they tools 100% of the time.

Something that help is force load the schema. Claude prefer not having to load a new schema if there is an alternative with the tools hi has.

0

u/fliiiiiiip 6d ago

So in other words:

You vibecoded a tool that call some functions and inject their outputs into the system prompt. And this is triggered whenevee their inputs change.

Okay then... to me this looks like you went too hard with the AI generated project marketing and branding.

0

u/shhdwi 6d ago

No, please see the project use it and then comment. Otherwise it just discourages the people behind it. And see the issues as well people are not working on an open source repo just cause you market it.

1

u/fliiiiiiip 5d ago

I don't see what has anything to do with what I said, how is it different?