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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@capyclaw/tool-host

v0.1.2

Published

DSH 公共工具面插件:能力 DSL、工具注册表、参数校验、契约报告、MCP 协议壳与 instructions 模板,向插件提供 ctx.toolHost。

Downloads

866

Readme

@capyclaw/tool-host

DSH 公共工具面插件。把每个插件都会重复写的工具声明、注册表、参数校验、契约报告、MCP 协议壳和 instructions 模板收成一套。

使用

export const inject = ['toolHost']

const echo = ctx.toolHost.defineTool({
  name: 'demo_echo',
  description: '回显文本',
  inputSchema: { type: 'object', properties: { text: { type: 'string' } }, required: ['text'] },
  handler: ({ text }) => ({ content: [{ type: 'text', text }] }),
})

const capabilities = [
  ctx.toolHost.defineCapability({ id: 'demo', title: 'Demo', tools: [echo] }),
]

const registry = ctx.toolHost.createRegistry(capabilities)
const mcp = ctx.toolHost.createMcpHandler({
  registry,
  instructions: ctx.toolHost.buildInstructions({ title: 'Demo', capabilities: registry.CAPABILITIES }),
})

原生 DSH 工具面

export const inject = ['toolHost']

export function apply(ctx) {
  const registry = ctx.toolHost.createRegistry(capabilities)
  const dispose = ctx.toolHost.registerWithDsh(ctx, registry, { namespace: 'demo' })
  return dispose
}

注册后工具直接出现在 ctx.tools,不需要 loopback /mcp 和 dsh-mcp-client row。 MCP handler 仍保留给跨进程/外部客户端。

提供什么

  • defineTool / defineCapability:声明式能力 DSL
  • createRegistry:校验 id/工具名/依赖/服务唯一性,派生 TOOLS / TOOL_IMPL / TOOL_META / FEATURES / CAPABILITIES
  • createToolDispatcher:统一参数校验后分派
  • createMcpHandler:MCP Streamable HTTP(initialize / ping / tools/list / tools/call)
  • createCapabilityReport:契约报告
  • buildInstructions:MCP server instructions 模板

边界

  • 不绑定具体插件;PPT 只是第一个消费者
  • 不负责 HTTP 监听;和 dsh-service-host 组合使用
  • 不负责契约快照文件;由构建脚本调用 registry.ctx.contract.report() 生成