Discover tools on demand instead of loading hundreds into context.
- Discover —
capabilities_discover with a task description
- Install —
capability_details with tool names (map to your model’s function-calling format)
- Invoke —
tools/call on the server path
Both discovery tools live on /pinkfish-sidekick.
Example: Discovery to Execution
const MCP_URL = "https://mcp.app.pinkfish.ai";
const TOKEN = "<YOUR_PLATFORM_JWT>";
const headers = {
Authorization: `Bearer ${TOKEN}`,
"Content-Type": "application/json",
Accept: "application/json",
};
async function callTool(serverPath, toolName, args) {
const resp = await fetch(`${MCP_URL}${serverPath}`, {
method: "POST",
headers,
body: JSON.stringify({
jsonrpc: "2.0",
method: "tools/call",
params: { name: toolName, arguments: args },
id: 1,
}),
});
const result = await resp.json();
if (result.error) throw new Error(result.error.message);
return result.result;
}
function parseResult(r) {
if (r?.structuredContent) return r.structuredContent;
return JSON.parse(r?.content?.[0]?.text ?? "{}");
}
async function discover(task) {
const r = await callTool("/pinkfish-sidekick", "capabilities_discover", { request: task });
return parseResult(r);
}
async function getDetails(items) {
const r = await callTool("/pinkfish-sidekick", "capability_details", { items });
return parseResult(r);
}
// 1. Discover
const capabilities = await discover("search the web for AI news");
const topTool = capabilities.tools?.[0];
if (!topTool) throw new Error("No tools found");
// 2. Install (optional - get schema when you need parameter details)
const details = await getDetails([topTool.name]);
// 3. Invoke
const result = await callTool(`/${topTool.serverName}`, topTool.name, {
query: "latest AI news 2026",
});
console.log(parseResult(result));
Node.js 18+ or browser. Python: requests.post() with same JSON-RPC payload.
Key Points
- Embedded tools: no PCID. Application tools: PCID from discovery or Connecting to MCPs.
- Pass
tool.name to capability_details, not serverName.
Custom Agents
Bootstrap with the two discovery tools. On user task: discover → fetch schemas → map to function-calling format → add to agent. Route model tool calls to tools/call. Install only what the user needs (typically 1–5 tools per task).
Code Execution Shortcut
Code Execution chains tools without installing them. Discover tools, then pass tool calls into a single code-execution_execute invocation.