Skip to main content
Glama
Buu-AI

Buu AI MCP Server

subthread_generate

Create new subthreads with customizable styles and prompts using the tool on Buu AI MCP Server. Ideal for organizing and expanding discussions or workflows efficiently.

Instructions

[PRIVATE] Generates a new subthread.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptNoOptional prompt text
styleNoOptional style input for subthread generation

Implementation Reference

  • The async handler function that implements the core logic of the subthread_generate tool. It sends a GraphQL mutation with the provided style and prompt to generate a new subthread and returns the JSON response or an error.
    async ({ style, prompt }) => {
      try {
        const response = await client.request(generateSubthreadMutation, {
          style,
          prompt,
        });
        return { content: [{ type: 'text', text: JSON.stringify(response) }] };
      } catch (error) {
        console.error('Error calling subthread_generate:', error);
        return {
          isError: true,
          content: [{ type: 'text', text: `Error: Failed to generate subthread. ${error}` }],
        };
      }
    }
  • Input schema defined using Zod validators for the optional 'style' parameter (SubthreadStyle enum) and 'prompt' parameter (string).
    {
      style: z
        .nativeEnum(SubthreadStyle)
        .optional()
        .describe('Optional style input for subthread generation'),
      prompt: z.string().optional().describe('Optional prompt text'),
    },
  • The server.tool() call that registers the 'subthread_generate' tool, including name, description, input schema, and handler function.
    server.tool(
      'subthread_generate',
      '[PRIVATE] Generates a new subthread.',
      {
        style: z
          .nativeEnum(SubthreadStyle)
          .optional()
          .describe('Optional style input for subthread generation'),
        prompt: z.string().optional().describe('Optional prompt text'),
      },
      async ({ style, prompt }) => {
        try {
          const response = await client.request(generateSubthreadMutation, {
            style,
            prompt,
          });
          return { content: [{ type: 'text', text: JSON.stringify(response) }] };
        } catch (error) {
          console.error('Error calling subthread_generate:', error);
          return {
            isError: true,
            content: [{ type: 'text', text: `Error: Failed to generate subthread. ${error}` }],
          };
        }
      }
    );
  • Type definition enum SubthreadStyle used in the input schema for the style parameter.
    export enum SubthreadStyle {
      'Realistic',
      'LowPoly',
      'Voxel',
      'Stylized',
      'Toon',
      'SciFi',
      'Fantasy',
      'Wireframe',
      'Clay',
      'Metallic',
      'Cute',
      'Isometric',
      'Weapons',
      'Environment',
    }
  • GraphQL mutation query definition used by the handler to perform the subthread generation.
    const generateSubthreadMutation = gql`
      mutation GenerateSubthread($style: JSON, $prompt: String) {
        generateSubthread(style: $style, prompt: $prompt) {
          ... on Subthread {
            _id
            createdAt
            updatedAt
            teamId
            threadId
            prompt
            style
            imageUrl
            strength
            address
          }
          ... on HandledError {
            code
            message
          }
        }
      }
    `;

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/Buu-AI/buu-mcp-server'

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