Examples
Integration recipes
Copyable end-to-end patterns for common PrompTessor API and MCP workflows.
Verified against the implementation ·
Submit an async job and poll it
const base = 'https://api.promptessor.com/v1';
const headers = {
Authorization: `Bearer ${process.env.PROMPTESSOR_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(),
Prefer: 'respond-async',
};
const submitted = await fetch(`${base}/prompts/analyze-and-optimize`, {
method: 'POST',
headers,
body: JSON.stringify({
prompt: 'Write a product announcement',
context: 'For technical founders. Be concise.',
variationCount: 2,
}),
});
if (submitted.status !== 202) throw new Error(await submitted.text());
const operation = await submitted.json();
while (true) {
const response = await fetch(`${base}/operations/${operation.id}`, {
headers: { Authorization: headers.Authorization },
});
const { data } = await response.json();
if (['succeeded', 'failed', 'cancelled'].includes(data.status)) {
console.log(data);
break;
}
await new Promise(resolve => setTimeout(resolve, 2000));
}Useful MCP requests
- “Use PrompTessor get_usage and tell me how many credits and concurrent AI operations are available.”
- “Use generate_prompt with outputMode ready_to_use and targetModel Claude. My goal is to create a detailed usability-test plan.”
- “Analyze this prompt, explain the weakest dimensions, then optimize it into one version.”
- “List my recent optimization history, open the newest item, and refine its best version to be more concise.”
- “List official Prompt Library items about research. Do not save, vote, publish, or modify anything.”
- “Create a private library item from this prompt. Show me the proposed title, description, and model list before calling the create tool.”
Least-privilege integration profiles
| Integration | Suggested scopes |
|---|---|
| Generation-only backend | prompts:generate, operations:read |
| Prompt quality service | prompts:analyze, prompts:optimize, prompts:refine, operations:read |
| Read-only personal assistant | usage:read, history:read, library:read, prompts:presets:read |
| Library manager | library:read, library:write; add library:publish only if required |
| Webhook administrator | webhooks:manage |