Skip to main content
Glama
DumplingAI

Dumpling AI MCP Server

Official
by DumplingAI

generate-agent-completion

Produce AI-generated text completions with tailored parameters such as agent ID, message arrays, and JSON parsing for customized responses in Dumpling AI MCP Server.

Instructions

Generate AI text completions with customizable parameters.

Input Schema

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

Implementation Reference

  • The handler function for the 'generate-agent-completion' tool. It fetches completions from the Dumpling API endpoint using the provided messages, agentId, parseJson, and threadId parameters.
    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 'generate-agent-completion' 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)
    Registration of the 'generate-agent-completion' tool on the MCP server, including name, description, input schema, and inline 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