tool-creation-patterns

Guide MCP tool pattern selection for the Turul MCP Framework.

2|Updated Aug 17, 2025
One-click install
npx skills add https://github.com/aussierobots/turul-mcp-framework --skill tool-creation-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tool-creation-patterns
Source: https://github.com/aussierobots/turul-mcp-framework/tree/main/plugins/turul-mcp-skills/skills/tool-creation-patterns
Command: npx skills add https://github.com/aussierobots/turul-mcp-framework --skill tool-creation-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps developers choose the most suitable MCP tool pattern (function macro, derive macro, or ToolBuilder) based on compile-time knowledge and runtime needs.

Core Features & Use Cases

  • Guidance on selecting between Level 1 (function macro), Level 2 (derive macro), and Level 3 (ToolBuilder) patterns.
  • Supports per-tool task settings, session access, and shared-state considerations (e.g., OnceLock) across patterns.
  • Real-world scenarios include stateless utilities, stateful tools requiring session context, and dynamic runtime tool definitions.

Quick Start

Ask it to determine the appropriate MCP tool pattern for a given tool requirement and register it using the corresponding macro or builder.

Frequently Asked Questions about tool-creation-patterns

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

FAQPage Schema
How do I choose the right MCP tool pattern for my Turul framework project?

Choose an MCP tool pattern by evaluating your compile-time knowledge and runtime needs. Use function macros for stateless utilities, derive macros for stateful tools, and ToolBuilder for dynamic runtime definitions.

What is the difference between function macro, derive macro, and ToolBuilder patterns?

The difference between function macro, derive macro, and ToolBuilder patterns is their flexibility level. Function macros handle simple stateless utilities, derive macros support stateful tools with session context, and ToolBuilder enables dynamic runtime tool definitions.

How do I register a stateful MCP tool that requires per-session state?

Register a stateful MCP tool needing per-session state using the derive macro pattern. It supports session access and per-tool task settings, maintaining context across interactions within the Turul MCP Framework.

Can I use OnceLock for shared state across MCP tool patterns?

Yes, you can use OnceLock for shared state across MCP tool patterns. The guidance covers shared-state considerations using OnceLock, ensuring safe concurrent access across utilities and stateful tools in the Turul MCP Framework.

When should I use the ToolBuilder pattern instead of macros for MCP tool registration?

Use the ToolBuilder pattern instead of macros when you need dynamic runtime tool definitions. ToolBuilder suits complex scenarios where tool structure is not fully known at compile time, unlike function and derive macros.

Does the Turul MCP Framework support stateless utilities alongside complex stateful tools?

Yes, the Turul MCP Framework supports both stateless utilities and complex stateful tools. Pattern guidance applies across simple stateless functions and complex tools requiring session context or shared state via OnceLock.