mudko
← back to docs

Craft your own MCP tool

Default tools included

Your generated surface already ships a suite of default tools that work with zero configuration (business info, contact, hours, locations, socials, page list, page content, site search, latest posts, FAQ, policies, pricing, team, reviews). This is how to add your own.

The one rule

Build against a data standard, degrade gracefully — never against a specific page's HTML.

A tool that scrapes a fragile CSS selector breaks the first time the theme changes. A tool that reads a standard — schema.org JSON-LD, sitemap.xml, RSS, Open Graph — keeps working, and returns null/empty when the data isn't there instead of throwing. Every default tool follows this rule.

Four tiers of tools

Tier 1Metadata · schema.org JSON-LD · Open Graph

Business name, contact, hours, locations, social links. Near-universal — already shipped as defaults.

Tier 2Content & structure · sitemap.xml · RSS/Atom · robots.txt

List pages, fetch a page's text, search the site, latest posts, FAQ. Light crawling — already shipped.

Tier 3Page conventions · predictable URLs + schema

Policies, pricing, team, reviews. Heuristic but reliable — already shipped.

Tier 4Transactional · YOUR backend (Calendly, Shopify, CRM…)

book_appointment, submit_contact_form, check_product_availability, create_lead. NOT universal — each needs a real integration. This is what the extension points are for.

The two extension points

WordPress plugin → the ark_mcp_tool_<name> filter

// functions.php — give your declared tool real behavior
add_filter('ark_mcp_tool_book_appointment', function ($result, $args) {
  $when = isset($args['datetime']) ? $args['datetime'] : null;   // validate!
  // ... call Calendly / your booking API here ...
  return array('status' => 'booked', 'confirmation' => 'ABC123', 'when' => $when);
}, 10, 2);
// Return non-null → live. Return nothing → honest "not implemented". Never fake a success.

Cloudflare Worker (or any host) → POST /api/v1/<tool>

The Worker proxies a custom tool call to your origin. Implement the endpoint to return JSON:

POST https://yoursite.com/api/v1/book-appointment
Content-Type: application/json

{ "datetime": "2026-09-01T14:00" }

→  { "status": "booked", "confirmation": "ABC123" }

Until the endpoint exists, the tool returns an honest "not implemented" notice — never a fake success.

Declare the tool (so agents discover it)

When you generate your bundle, set a primary tool: a snake_casename + a "Use this when…" description. That adds it to your MCP server-card, agent-card, andwebmcp.js. Give it a real inputSchema so agents know what to send:

{
  "type": "object",
  "properties": {
    "datetime": { "type": "string", "description": "ISO 8601 start time" }
  },
  "required": ["datetime"]
}

Checklist for a good tool

  1. Reads a standard, or hits your API — not a scraped selector.
  2. Returns null/empty when data is missing; never fabricates.
  3. Has a real inputSchema with descriptions.
  4. Idempotent for reads; clearly side-effecting for writes (bookings, leads).

Need a live /api/mcp first? See the Cloudflare Worker guide, or let us build it.