api.mcp

call()

api.mcp.call(name, tool, args, { signal? }) → Promise<Result>

تشغيل واحدة من أدوات الخادم بدون وكيل -- للتحقق من اتصال، أو لأنك تكتب حلقة الخاصة بك.

no agent60 sno permission callback
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

const result = await api.mcp.call("example", "search_docs", { query: "retry policy" });
console.log(result);
result = api.mcp.call("example", "search_docs", {"query": "retry policy"})
print(result)
namestringمطلوب

الخادم

toolstringمطلوب

الـ أداة خادم الاسم الإيطالية.

argsobject{}

حججه.

signalAbortSignal

يلغي المكالمة

ما تفعله

يقرأ الاتصال، يصافح الأيدي، ويدعو الأداة -- يحمل الشروح الرأسية المطلوبة من مخطط الخادم. النتيجة هي مخرجات الخادم، مقسومة على 60000 حرف مع ملاحظة تقول كم تبقى منها.

لا يوجد إذن بالإعادة إلى هنا

هذا هو قرارك، وليس وكيل

الـ تصنيف ما هو الوكيل هو مطلوب: تسمية نفسك تجاوز ذلك كليّا، لأنّك هو من يقرر. لا توجه اختيار نموذج من خلال هذا - أعط النموذج الأداة من خلال الوكيل، حيث تنطبق الفئة.

وهي غير ملزمة بالقائمة المسموح بها

القائمة المسموح بها تقرر ما أُعلنت لنموذجان الدعوة الى أداة ما هي قرار قمت به بالفعل ، وهذا ما يجعل هذا مفيدا لتفقد أداة قبل السماح بها .

ستون ثانية

A call has a 60-second ceiling, and listing tools 30. A server that goes quiet raises mcp_timeout rather than holding a run open.

كتابة حلقة الخاص بك

const tools = await api.mcp.tools(["example"]);
const turn = await api.models.turn({ model: "gemini-3.5-flash", messages, tools });

for (const call of turn.message.toolCalls ?? []) {
  const [server, tool] = splitYourWay(call.name);
  const output = await api.mcp.call(server, tool, call.args);
  // feed it back as a tool message
}
tools = api.mcp.tools(["example"])
turn = api.models.turn(model="gemini-3.5-flash", messages=messages, tools=tools)

for call in turn["message"].get("toolCalls") or []:
    server, tool = split_your_way(call["name"])
    output = api.mcp.call(server, tool, call["args"])
    # feed it back as a tool message