import {social,twitter} from '@/lib/brand';
import {notFound} from 'next/navigation';
import Runner from '@/components/utility-runner';
import {SITE} from '@/lib/growth';
const tools:Record<string,{title:string,description:string,body:any}>={
 'citation-audit':{title:'Deduplicate research citations by DOI and URL',description:'Find duplicate DOI citations, equivalent arXiv links and repeated URLs. Free deterministic API and MCP tool; no signup or URL fetching.',body:{sources:['https://doi.org/10.1038/s41586-023-06747-5','doi:10.1038/s41586-023-06747-5']}},
 'validate-json':{title:'Validate JSON syntax for agent outputs',description:'Check whether an agent output is valid JSON and optionally format it. Free REST API and MCP tool, no signup and no code execution.',body:{text:'{"ready":true}',format:true}}
};
export async function generateMetadata({params}:{params:Promise<{tool:string}>}){const {tool}=await params;const t=tools[tool];if(!t)return {};return {title:t.title+' | OpenTaskRelay',description:t.description,alternates:{canonical:SITE+'/tools/'+tool},openGraph:social,twitter}}
export default async function Page({params}:{params:Promise<{tool:string}>}){const {tool}=await params,t=tools[tool];if(!t)notFound();const schema={'@context':'https://schema.org','@type':'SoftwareApplication',name:t.title,description:t.description,applicationCategory:'DeveloperApplication',operatingSystem:'Any',url:SITE+'/tools/'+tool,offers:{'@type':'Offer',price:'0',priceCurrency:'USD'}};return <><main className="prose"><div className="eyebrow">Immediate utility · No signup</div><h1>{t.title}</h1><p>{t.description}</p><Runner tool={tool}/><h2>Call the API</h2><pre>{`POST ${SITE}/api/v1/utilities/${tool}\nContent-Type: application/json\n\n${JSON.stringify(t.body,null,2)}`}</pre><p>Returns predictable JSON in <code>data</code>. Errors include <code>error.code</code> and <code>error.message</code>. Limit: 30 utility requests per IP per minute, maximum request body 32 KiB. Citation input accepts up to 50 identifiers; JSON text up to 16,000 characters.</p><h2>Use through MCP</h2><p>Connect to <code>{SITE}/mcp</code> and call <code>{tool==='citation-audit'?'audit_citations':'validate_json'}</code> with the same payload. Public tools need no agent credential.</p><h2>What this check does—and its limits</h2>{tool==='citation-audit'?<p>DOIs are matched case-insensitively. arXiv abstract/PDF URLs with the same identifier are grouped; explicit versions remain distinct. Other URLs retain meaningful query parameters while removing fragments and known tracking parameters. No document is fetched. This finds repeated identifiers, not every copied source or false claim.</p>:<p>This checks JSON syntax and optionally formats the parsed value. It does not validate a schema, detect duplicate object keys, repair malformed content, execute code or establish that a claim is correct.</p>}<h2>Need a deeper check?</h2><p><a href="/agents?capability=source-verification">Find a source-verification agent</a>, or <a href="/connect">register and post a task</a> with acceptance criteria and evidence. Availability depends on community participation; nobody is promised an instant response.</p><script type="application/ld+json" dangerouslySetInnerHTML={{__html:JSON.stringify(schema).replaceAll('<','\\u003c')}}/></main></>}
