agent-tools
Build MCP servers and agent tools. Covers tool design, MCP protocol, input validation, error handling, and testing. Use when: "build a tool", "MCP server", "agent tool", "function calling", "give the agent access to", or when agents need new capabilities.
- License 许可
- MIT
- 所属仓库
- kalash33/kstack
- 最近更新
- 2026-05-20
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- agent-tools
- description
- Build MCP servers and agent tools. Covers tool design, MCP protocol, input validation, error handling, and testing. Use when: "build a tool", "MCP server", "agent tool", "function calling", "give the agent access to", or when agents need new capabilities.
03 SKILL.md 正文
/agent-tools — Tool Builder
Tools are how agents interact with the world. Build them right.
When to Use
- Agent needs a new capability (API access, file ops, browser, etc.)
- Building an MCP server
- Designing function-calling interfaces
- Wrapping an API for agent use
Tool Design Principles
- One tool, one job. Don't combine search + filter + format.
- Clear descriptions. The LLM reads them to decide when to call.
- Typed inputs. Validate everything. Agents will send garbage.
- Useful errors. "Invalid date format, expected YYYY-MM-DD" not "Error".
- Idempotent when possible. Agents retry. Don't double-charge.
MCP Server Template
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
const server = new McpServer({ name: "my-tool", version: "1.0.0" });
server.tool(
"search_docs",
"Search documentation by keyword. Returns top 5 matches.",
{ query: z.string().describe("Search query") },
async ({ query }) => {
const results = await searchIndex(query);
return { content: [{ type: "text", text: JSON.stringify(results) }] };
}
);
const transport = new StdioServerTransport();
await server.connect(transport);
Python Tool Template
def search_docs(query: str) -> str:
"""Search documentation by keyword. Returns top 5 matches.
Args:
query: The search query string
Returns:
JSON string with matching documents
"""
if not query or len(query) > 500:
return json.dumps({"error": "Query must be 1-500 characters"})
results = index.search(query, limit=5)
return json.dumps({"results": results})
Testing Tools
# Test happy path
assert "results" in json.loads(search_docs("authentication"))
# Test edge cases
assert "error" in json.loads(search_docs(""))
assert "error" in json.loads(search_docs("x" * 501))
# Test with actual agent
response = agent.run("Find docs about authentication")
assert "search_docs" in response.tool_calls
Chaining
- Before:
/agent-design(identifies what tools are needed) - After:
/agent-build(wires tools into agents)
04 同仓库更多 Skills
zustand-store-ts
Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reacti...
zoom-automation
Automate Zoom meeting creation, management, recordings, webinars, and participant tracking via Rube MCP (Composio). Always search tools first for current schemas.
zoho-crm-automation
Automate Zoho CRM tasks via Rube MCP (Composio): create/update records, search contacts, manage leads, and convert leads. Always search tools first for current schemas.
zod-validation-expert
Expert in Zod — TypeScript-first schema validation. Covers parsing, custom errors, refinements, type inference, and integration with React Hook Form, Next.js, and tRPC.
zeroize-audit
Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C/C++/Rust code handling secrets, keys, passwords, or other sensitive data.
zendesk-automation
Automate Zendesk tasks via Rube MCP (Composio): tickets, users, organizations, replies. Always search tools first for current schemas.