add-mcp-tool

Create FastMCP tools exposing StockTrim helpers with Pydantic models.

Updated Jul 18, 2025
One-click install
npx skills add https://github.com/dougborg/stocktrim-openapi-client --skill add-mcp-tool-dougborg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-mcp-tool
Source: https://github.com/dougborg/stocktrim-openapi-client/tree/main/.claude/skills/add-mcp-tool
Command: npx skills add https://github.com/dougborg/stocktrim-openapi-client --skill add-mcp-tool-dougborg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the problem of turning existing StockTrim client helper functions into MCP tools that AI assistants can call reliably and safely with correct schemas.

Core Features & Use Cases

  • Layered design enforcement: Ensures tools call services and services call helpers (and never bypass layers) so behavior stays testable and maintainable.
  • Typed Pydantic I/O for FastMCP: Defines request and response models to produce deterministic, validation-ready tool interfaces for AI hosts.
  • MCP-safe JSON output: Returns results using make_json_result to prevent content-channel drift and keep MCP integration consistent.
  • Isolated, mocked testing: Guides you to mock the StockTrim client at the service boundary and assert via unwrap_tool_result for clean typed verification.

Quick Start

Use the add-mcp-tool skill to create a new MCP tool that exposes an existing helper method end-to-end, including the FastMCP tool registration, service wrapper, and a mocked MCP test.

Frequently Asked Questions about add-mcp-tool

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I expose a Python helper function as a Model Context Protocol tool using FastMCP?

To expose a Python helper as an MCP tool, you wrap it in a FastMCP tool registration with Pydantic-typed request and response models. This enforces a tool→service→helper call chain, ensuring AI clients can safely call the function with deterministic, validation-ready schemas.

How does Pydantic typing work with FastMCP tool generation for AI assistants?

Pydantic typing in FastMCP tool generation defines strict request and response models for your helper functions. This produces deterministic, validation-ready tool interfaces that AI hosts can reliably parse, preventing schema drift when AI assistants call your service layer operations.

What's the best way to test MCP tools without making real HTTP calls to the client?

The best way to test MCP tools without real HTTP calls is to mock the client at the service boundary. You then assert tool outputs using unwrap_tool_result for clean typed verification, ensuring tests remain isolated and validate the tool→service→helper chain without external dependencies.

Does FastMCP require a specific service layer architecture for tool generation?

FastMCP tool generation requires a layered service architecture where tools call services and services call helpers. This design prevents layer bypasses, keeps behavior testable and maintainable, and ensures results return through make_json_result to maintain consistent MCP integration without content-channel drift.

Why does my MCP tool output drift from the expected JSON format?

MCP tool output drifts from expected JSON formats when not using make_json_result. This helper function standardizes JSON output, preventing content-channel drift and keeping MCP integration consistent across all tool registrations exposed to AI clients.

Can I use an existing OpenAPI client helper as an MCP tool?

Yes, you can expose an existing OpenAPI client helper as an MCP tool. The process creates a FastMCP tool registration with Pydantic-typed I/O models, wrapping the helper in a service layer to enforce the required tool→service→helper call chain for safe AI client access.