Urgent.News

What's breaking now, across thousands of outlets.

Tech

Why Toolgrain keeps MCP tools separate from servers

I started Toolgrain while building Pushwing and experimenting with Elysia for an MCP integration. I wanted a TypeScript workflow where I could define a tool independently, get useful types from its input and output schemas, and reuse that definition across servers. The approach I was using wasn’t giving me that combination, and the documentation I found didn’t give me a clear path to the…

Toolgrain is a toolkit designed to separate tool definitions from server execution and transport mechanisms. This separation allows for greater flexibility and reuse of tool definitions across different MCP servers. The core idea is to define a tool as a standalone, self-contained entity that includes its description, Zod schemas, and handler function.

A server registers these tool definitions under specific names, which are then discoverable by MCP clients. The transport layer is responsible for handling how requests are received, such as through stdio or HTTP POST requests.

For example, a TypeScript tool can be defined in a file like `server.mts`, where the tool's schema and behavior are specified using Zod for input validation and output structuring. The server is then created using the `createServer` function, specifying the tool names and their corresponding handler functions. The server can be started, listening for requests on stdin/stdout using a transport such as `stdio()`.

When a tool is invoked via the MCP Inspector CLI, the tool's TypeScript definition is separate from the actual server implementation. The server acts merely as a mediator, validating the input against the tool's schema and returning the result according to the specified output schema. This separation enables the same tool to be used across multiple servers, each potentially using a different transport mechanism or server-side implementation.

By keeping tool definitions, server execution, and transport mechanisms separate, Toolgrain provides a modular and flexible approach to building MCP-based applications. This design enables developers to define reusable tool logic, register them under desired names, and manage how they are accessed and executed across various environments.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

PHANTOM Terminal: Something Is Still Running 👻

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine . What I Built What if your terminal could tell ghost stories?

  • PHANTOM Terminal generates eerie transmissions and ghost stories locally
  • Features include Terminal Haunting, Ghost Story, and Memory Archive modes
  • Open-source application prioritizes privacy and offline access

Why Your Charger Stops Working the Moment You Land

I work on the manufacturing side of travel chargers, and the confusion I deal with most is remarkably persistent: someone buys a plug adapter for their trip, arrives, plugs in, and either nothing…

  • Travel chargers often stop working upon arrival due to plug shape and voltage mismatch.
  • Modern electronics with switch-mode supplies are universally compatible with appropriate adapters.

Today I'm coding

The weeds are pulled, the dirt is off my boots, and today I'm back in front of the keyboard. By the way - my garden totally looks like a battleground from a WW2 movie!

  • Author returns to coding after garden reflects WWII battlefield
  • Author refactors project like scorched-earth approach
  • Author commits to coding relentlessly, new endeavors planned

Django Explained: Python's Batteries-Included Framework

Introduction Django is Python's most popular web framework, and its philosophy is the opposite of minimal: "batteries included".

  • Django is Python's most popular web framework with "batteries included" philosophy
  • ORM, admin panel, authentication, forms, and security are built-in features
  • Django automatically generates database schema, forms, and admin interface from models

More from Tuesday 27 October →