Skip to main content
Glama
DumplingAI

Dumpling AI MCP Server

Official
by DumplingAI

generate-agent-completion

Generate AI text completions using customizable parameters like agent selection and conversation history for tailored responses.

Instructions

Generate AI text completions with customizable parameters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messagesYesArray of messages
agentIdYesAgent ID
parseJsonNoParse response as JSON
threadIdNoThread ID for conversation history

Implementation Reference

  • The async handler function that executes the tool logic by making a POST request to the external Dumpling AI API endpoint `/api/v1/agents/generate-completion` with the provided parameters and returns the JSON response formatted as MCP content.
    async ({ messages, agentId, parseJson, threadId }) => { const apiKey = process.env.DUMPLING_API_KEY; if (!apiKey) throw new Error("DUMPLING_API_KEY not set"); const response = await fetch( `${NWS_API_BASE}/api/v1/agents/generate-completion`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ messages, agentId, parseJson, threadId }), } ); if (!response.ok) throw new Error(`Failed: ${response.status} ${await response.text()}`); const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; }
  • Zod schema defining the input parameters for the tool: messages (array of role/content objects), agentId (string), parseJson (optional boolean), threadId (optional string).
    { messages: z .array( z.object({ role: z.enum(["user", "assistant"]), content: z.string() }) ) .describe("Array of messages"), agentId: z.string().describe("Agent ID"), parseJson: z.boolean().optional().describe("Parse response as JSON"), threadId: z .string() .optional() .describe("Thread ID for conversation history"), },
  • src/index.ts:857-892 (registration)
    The server.tool registration call that defines and registers the 'generate-agent-completion' tool with its name, description, input schema, and handler function.
    server.tool( "generate-agent-completion", "Generate AI text completions with customizable parameters.", { messages: z .array( z.object({ role: z.enum(["user", "assistant"]), content: z.string() }) ) .describe("Array of messages"), agentId: z.string().describe("Agent ID"), parseJson: z.boolean().optional().describe("Parse response as JSON"), threadId: z .string() .optional() .describe("Thread ID for conversation history"), }, async ({ messages, agentId, parseJson, threadId }) => { const apiKey = process.env.DUMPLING_API_KEY; if (!apiKey) throw new Error("DUMPLING_API_KEY not set"); const response = await fetch( `${NWS_API_BASE}/api/v1/agents/generate-completion`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ messages, agentId, parseJson, threadId }), } ); if (!response.ok) throw new Error(`Failed: ${response.status} ${await response.text()}`); const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DumplingAI/mcp-server-dumplingai'

If you have feedback or need assistance with the MCP directory API, please join our Discord server