Skip to main content
Glama

get_filament

Retrieve detailed specifications for 3D printing filaments including temperatures, density, weight, colors, and manufacturer information by ID or exact name.

Instructions

Get detailed information about a specific filament by ID or exact name. Returns full specs: temperatures, density, weight, colors, and manufacturer details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNoFilament ID
nameNoExact filament name

Implementation Reference

  • The handler function for 'get_filament' tool, which processes input and fetches filament data.
    async ({ id, name }) => {
      let filament: FilamentRow | null = null;
    
      if (id != null) {
        filament = getFilamentById(db, id);
      } else if (name != null) {
        filament = getFilamentByName(db, name);
      } else {
        return {
          isError: true,
          content: [
            {
              type: 'text' as const,
              text: 'Please provide either an id or name. Use search_filaments to find filaments first.',
            },
          ],
        };
      }
    
      if (!filament) {
        return {
          isError: true,
          content: [
            {
              type: 'text' as const,
              text: `Filament not found. Try using search_filaments to find the correct name or ID.`,
            },
          ],
        };
      }
    
      return {
        content: [
          { type: 'text' as const, text: formatFilamentDetail(filament) },
        ],
      };
    },
  • The Zod-based input schema for the 'get_filament' tool.
    inputSchema: {
      id: z.number().optional().describe('Filament ID'),
      name: z.string().optional().describe('Exact filament name'),
    },
  • The registration function that exposes 'get_filament' tool to the MCP server.
    export function registerGetFilament(
      server: McpServer,
      db: Database.Database,
    ): void {
      server.registerTool(
        'get_filament',
        {
          title: 'Get Filament',
          description:
            'Get detailed information about a specific filament by ID or exact name. Returns full specs: temperatures, density, weight, colors, and manufacturer details.',
          inputSchema: {
            id: z.number().optional().describe('Filament ID'),
            name: z.string().optional().describe('Exact filament name'),
          },
        },
        async ({ id, name }) => {
          let filament: FilamentRow | null = null;
    
          if (id != null) {
            filament = getFilamentById(db, id);
          } else if (name != null) {
            filament = getFilamentByName(db, name);
          } else {
            return {
              isError: true,
              content: [
                {
                  type: 'text' as const,
                  text: 'Please provide either an id or name. Use search_filaments to find filaments first.',
                },
              ],
            };
          }
    
          if (!filament) {
            return {
              isError: true,
              content: [
                {
                  type: 'text' as const,
                  text: `Filament not found. Try using search_filaments to find the correct name or ID.`,
                },
              ],
            };
          }
    
          return {
            content: [
              { type: 'text' as const, text: formatFilamentDetail(filament) },
            ],
          };
        },
      );
    }

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/gregario/3dprint-oracle'

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