custom-tool-development

Guide development, testing, and debugging of custom tools with Python decorators and JSON Schema.

5|2|Updated Jan 24, 2026
One-click install
npx skills add https://github.com/s1366560/agi-demos --skill custom-tool-development
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: custom-tool-development
Source: https://github.com/s1366560/agi-demos/tree/main/.memstack/skills/custom-tool-development
Command: npx skills add https://github.com/s1366560/agi-demos --skill custom-tool-development

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to creating, testing, and debugging custom tools, enabling users to extend the agent's functionality beyond its built-in capabilities.

Core Features & Use Cases

  • Tool Creation: Learn how to define custom tools using the @tool_define decorator and structure them within the .memstack/tools/ directory.
  • Testing & Debugging: Understand patterns for unit testing tools in isolation and common issues encountered during development.
  • API Reference: Access detailed documentation for ToolContext, ToolResult, ToolInfo, and CustomToolLoader.
  • Use Case: A user wants to integrate a proprietary internal API into the agent. They can use this Skill to learn how to wrap the API calls in a custom tool, define its parameters, and ensure it's discoverable and testable by the agent.

Quick Start

Create a new Python file in the .memstack/tools/ directory and define your tool using the @tool_define decorator.

Frequently Asked Questions about custom-tool-development

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

FAQPage Schema
How do I create custom tools for an AI agent using Python?

You create custom tools by defining functions with the @tool_define decorator in a Python file within the .memstack/tools/ directory, specifying parameters using JSON Schema for the agent to discover and use.

What is the best way to test custom agent tools in isolation?

You test custom agent tools in isolation by using the CustomToolLoader methodology, which allows you to verify individual tool execution and parameter handling independently before integrating them fully into the agent workflow.

Why does my custom tool fail to load with an import error?

Custom tool import errors often occur due to missing @tool_define decorators, incorrect file structure conventions outside the .memstack/tools/ directory, or naming conflicts caused by duplicate tool names across files.

How do I handle errors and return results from a custom agent tool?

You handle errors and return results from a custom agent tool by utilizing the ToolResult object within the function logic, while accessing necessary runtime information through the ToolContext object.

Can I integrate a proprietary internal API into an AI agent?

You can integrate a proprietary internal API by wrapping the API calls inside a custom tool definition, configuring the required parameters with JSON Schema, and ensuring the tool is testable by the agent.

What is the ToolContext used for when developing custom tools?

The ToolContext provides essential runtime information and environment access to your custom tool during execution, allowing the function to interact safely with the agent platform and return structured ToolResult outputs.