From 9e26a7cf8922ad66e3ea6868ffc39b6a38393963 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 8 Nov 2026 11:51:43 +0000 Subject: [PATCH] Add tool titles for the Claude Connectors Directory The directory requires a title plus readOnlyHint or destructiveHint on every tool (Software Directory Policy 5E). Titles added to all tools; a test keeps it that way. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01R4cLjeb3VCoUVRb4CybVSL --- src/web_intel_mcp/server.py | 16 ++++++++-------- tests/test_directory.py | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 tests/test_directory.py diff --git a/src/web_intel_mcp/server.py b/src/web_intel_mcp/server.py index f814bc9..dce8aa1 100644 --- a/src/web_intel_mcp/server.py +++ b/src/web_intel_mcp/server.py @@ -84,7 +84,7 @@ def _billing_note(receipt: dict, credits: int) -> dict[str, Any]: return {"credits_charged": credits, "credits_remaining": receipt.get("remaining_balance")} -@mcp.tool(annotations=RO, meta=UI) +@mcp.tool(title="Read web page as text", annotations=RO, meta=UI) async def read_url(url: str, ctx: Context, max_chars: int = 20000) -> dict[str, Any]: """Fetch a web page and return its main content as clean Markdown (nav, ads and cookie banners removed). @@ -98,35 +98,35 @@ async def read_url(url: str, ctx: Context, max_chars: int = 20000) -> dict[str, return {**out, "billing": _billing_note(receipt, PRICES["read_url"])} -@mcp.tool(annotations=RO, meta=UI) +@mcp.tool(title="Get page metadata", annotations=RO, meta=UI) async def page_metadata(url: str, ctx: Context) -> dict[str, Any]: """Title, description, canonical, lang, robots, Open Graph, JSON-LD types, H1-H3 and image alt stats.""" out, receipt = await _paid(ctx, "page_metadata", url, analyze.metadata) return {**out, "billing": _billing_note(receipt, PRICES["page_metadata"])} -@mcp.tool(annotations=RO, meta=UI) +@mcp.tool(title="Extract page links", annotations=RO, meta=UI) async def extract_links(url: str, ctx: Context, limit: int = 200) -> dict[str, Any]: """Internal and external links on a page (deduplicated, absolute URLs, anchor text).""" out, receipt = await _paid(ctx, "extract_links", url, analyze.links, max(1, min(int(limit), 1000))) return {**out, "billing": _billing_note(receipt, PRICES["extract_links"])} -@mcp.tool(annotations=RO, meta=UI) +@mcp.tool(title="Detect website tech stack", annotations=RO, meta=UI) async def tech_stack(url: str, ctx: Context) -> dict[str, Any]: """Detect frameworks, CMS, analytics, payments, CDN/hosting and security headers of a site.""" out, receipt = await _paid(ctx, "tech_stack", url, analyze.tech_stack) return {**out, "billing": _billing_note(receipt, PRICES["tech_stack"])} -@mcp.tool(annotations=RO, meta=UI) +@mcp.tool(title="Audit page SEO", annotations=RO, meta=UI) async def seo_audit(url: str, ctx: Context) -> dict[str, Any]: """Scored on-page SEO audit (0-100, A-F) with 16 weighted checks and the top fixes to apply first.""" out, receipt = await _paid(ctx, "seo_audit", url, analyze.seo_audit) return {**out, "billing": _billing_note(receipt, PRICES["seo_audit"])} -@mcp.tool(annotations=RO, meta=UI) +@mcp.tool(title="Compare SEO of pages", annotations=RO, meta=UI) async def compare_seo(urls: list[str], ctx: Context) -> dict[str, Any]: """Audit 2-5 pages (e.g. you vs competitors) and rank them. Costs seo_audit price x number of URLs. @@ -156,7 +156,7 @@ async def compare_seo(urls: list[str], ctx: Context) -> dict[str, Any]: return {"ranking": results, "failed": failed, "billing": _billing_note(receipt, unit * len(pages))} -@mcp.tool(annotations=ToolAnnotations(readOnlyHint=True, openWorldHint=False)) +@mcp.tool(title="Show tool prices", annotations=ToolAnnotations(readOnlyHint=True, openWorldHint=False)) def pricing() -> dict[str, Any]: """Credit price of each tool and where to buy credits. Free.""" return {"credits_per_call": {**PRICES, "compare_seo": f"{PRICES['seo_audit']} x URLs"}, @@ -164,7 +164,7 @@ def pricing() -> dict[str, Any]: "buy_credits": billing.checkout_url or "Set KEYFLINT_CHECKOUT_URL"} -@mcp.tool(annotations=ToolAnnotations(readOnlyHint=True, openWorldHint=False), meta=UI) +@mcp.tool(title="Check credit balance", annotations=ToolAnnotations(readOnlyHint=True, openWorldHint=False), meta=UI) async def credits_balance(ctx: Context) -> dict[str, Any]: """Remaining credits on your KeyFlint license. Free.""" return await billing.balance(_headers(ctx)) diff --git a/tests/test_directory.py b/tests/test_directory.py new file mode 100644 index 0000000..7171ed1 --- /dev/null +++ b/tests/test_directory.py @@ -0,0 +1,14 @@ +"""Claude Connectors Directory: every tool declares a title and readOnlyHint or destructiveHint (policy 5E).""" +from __future__ import annotations + +from web_intel_mcp import server + + +async def test_every_tool_has_title_and_hint(): + tools = await server.mcp.list_tools() + assert tools + for t in tools: + assert t.title and len(t.title) <= 60, t.name + assert t.annotations and (t.annotations.read_only_hint is not None + or t.annotations.destructive_hint is not None), t.name + assert len({t.title for t in tools}) == len(tools)