npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@sylphlab/tools-core

v0.4.1

Published

Core types and utilities for Sylph Lab Tools packages

Downloads

201

Readme

@sylphlab/tools-core

NPM version

The foundational building blocks for creating robust and consistent tools within the SylphLab ecosystem.

This package provides the essential core types, interfaces, and utility functions, most notably defineTool, used across all SylphLab tool packages. It ensures a standardized approach to tool definition, making tools easier to create, manage, and integrate.

Purpose

Creating tools that can be used by AI agents, MCP servers, or other automated systems requires clear definitions, including input/output schemas and metadata. @sylphlab/tools-core provides the framework for this:

  • Standardization: Defines common interfaces (SylphTool, SylphToolDefinition) that all tools should adhere to.
  • Schema Definition: Integrates with Zod for defining strongly-typed input and output schemas, ensuring data integrity.
  • Utility Functions: Offers helpers like defineTool to simplify the process of creating valid tool definitions.
  • Consistency: Ensures that tools developed across different packages share a common structure, facilitating integration and adaptation (e.g., via @sylphlab/tools-adaptor-mcp or @sylphlab/tools-adaptor-vercel).

Key Features

  • defineTool Utility: A helper function to streamline the creation of SylphTool definitions, including name, description, Zod schemas, and the handler function.
  • Core Types (SylphTool, SylphToolDefinition): TypeScript interfaces defining the standard structure for all tools.
  • Zod Integration: Encourages the use of Zod for robust schema definition and validation.
  • Foundation for Tool Ecosystem: Serves as the base upon which all other @sylphlab/tools-* packages are built.

Installation

This package is a fundamental dependency for other tool packages within the mcp monorepo. It's typically not used directly in end-user applications but is essential when developing new tool packages.

# From the root of the monorepo, when creating a new tool package
pnpm add @sylphlab/tools-core --filter <your-new-tool-package-name>

Usage: Defining a Tool

Here's a conceptual example of how defineTool is used:

import { z } from 'zod';
import { defineTool } from '@sylphlab/tools-core';

// 1. Define Input Schema using Zod
const inputSchema = z.object({
  fileName: z.string().describe('The name of the file to create.'),
  content: z.string().optional().describe('Optional initial content for the file.'),
});

// 2. Define Output Schema using Zod
const outputSchema = z.object({
  success: z.boolean().describe('Whether the file was created successfully.'),
  filePath: z.string().optional().describe('The full path to the created file if successful.'),
  error: z.string().optional().describe('Error message if creation failed.'),
});

// 3. Define the Tool Handler Function
async function createFileHandler(input: z.infer<typeof inputSchema>) {
  try {
    // ... logic to create the file using input.fileName and input.content ...
    const fullPath = '/path/to/' + input.fileName; // Example path
    // Simulate success
    return { success: true, filePath: fullPath };
  } catch (err: any) {
    return { success: false, error: err.message };
  }
}

// 4. Define the Tool using defineTool
export const createFileTool = defineTool({
  name: 'createFile',
  description: 'Creates a new file with optional content.',
  inputSchema: inputSchema,
  outputSchema: outputSchema,
  handler: createFileHandler,
});

// Now `createFileTool` is a standard SylphTool object
// ready to be used by adapters or MCP servers.

Why Use @sylphlab/tools-core?

  • Consistency: Ensures all tools follow the same structural pattern.
  • Type Safety: Leverages TypeScript and Zod for robust definitions.
  • Reusability: Core logic defined once can be adapted for multiple platforms (MCP, Vercel AI, etc.).
  • Maintainability: Standardized definitions make the tool ecosystem easier to understand and maintain.

Dependencies

  • zod: The cornerstone for schema definition and validation.

Developed by Sylph Lab.