Skip to main content
Glama

mcp_openai_embedding

Generate text embeddings using OpenAI's API for integration with Ontology MCP, enabling AI models to process and analyze textual data within semantic frameworks.

Instructions

OpenAI Embeddings API를 사용하여 텍스트 임베딩을 생성합니다

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dimensionsNo임베딩 차원 수 (API가 지원하는 경우)
modelNo사용할 모델 (예: text-embedding-3-small, text-embedding-3-large)
textYes임베딩을 생성할 텍스트 또는 텍스트 배열

Implementation Reference

  • Core handler implementation: Calls OpenAI Embeddings API (/v1/embeddings) with text input, model, and optional dimensions, returns JSON of response data.
    /**
     * Embeddings API를 사용하여 텍스트 임베딩을 생성합니다
     */
    async generateEmbeddings(args: {
      text: string | string[];
      model?: string;
      dimensions?: number;
    }): Promise<string> {
      try {
        if (!OPENAI_API_KEY) {
          throw new McpError(
            ErrorCode.InternalError,
            'OPENAI_API_KEY가 설정되지 않았습니다.'
          );
        }
    
        const response = await axios.post(
          `${OPENAI_API_BASE}/embeddings`,
          {
            model: args.model || 'text-embedding-3-small',
            input: args.text,
            dimensions: args.dimensions
          },
          {
            headers: {
              'Content-Type': 'application/json',
              'Authorization': `Bearer ${OPENAI_API_KEY}`
            }
          }
        );
    
        return JSON.stringify(response.data, null, 2);
      } catch (error) {
        if (axios.isAxiosError(error)) {
          const statusCode = error.response?.status;
          const responseData = error.response?.data;
          
          throw new McpError(
            ErrorCode.InternalError,
            `OpenAI API 오류 (${statusCode}): ${
              typeof responseData === 'object' 
                ? JSON.stringify(responseData, null, 2) 
                : responseData || error.message
            }`
          );
        }
        
        throw new McpError(ErrorCode.InternalError, `임베딩 생성 요청 실패: ${formatError(error)}`);
      }
    }
  • Tool registration: Defines name, description, input schema, and thin handler that delegates to openaiService.generateEmbeddings.
      name: 'mcp_openai_embedding',
      description: 'OpenAI Embeddings API를 사용하여 텍스트 임베딩을 생성합니다',
      inputSchema: {
        type: 'object',
        properties: {
          text: {
            type: ['string', 'array'],
            description: '임베딩을 생성할 텍스트 또는 텍스트 배열'
          },
          model: {
            type: 'string',
            description: '사용할 모델 (예: text-embedding-3-small, text-embedding-3-large)'
          },
          dimensions: {
            type: 'number',
            description: '임베딩 차원 수 (API가 지원하는 경우)'
          }
        },
        required: ['text']
      },
      async handler(args: any): Promise<ToolResponse> {
        try {
          const result = await openaiService.generateEmbeddings(args);
          return {
            content: [{
              type: 'text',
              text: result
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: 'text',
              text: `OpenAI 임베딩 오류: ${error instanceof Error ? error.message : String(error)}`
            }]
          };
        }
      }
    },
  • Input schema validation for the tool: requires 'text', optional 'model' and 'dimensions'.
    inputSchema: {
      type: 'object',
      properties: {
        text: {
          type: ['string', 'array'],
          description: '임베딩을 생성할 텍스트 또는 텍스트 배열'
        },
        model: {
          type: 'string',
          description: '사용할 모델 (예: text-embedding-3-small, text-embedding-3-large)'
        },
        dimensions: {
          type: 'number',
          description: '임베딩 차원 수 (API가 지원하는 경우)'
        }
      },
      required: ['text']
    },
  • src/index.ts:43-43 (registration)
    Tool enabled (true) in the main server configuration flags.
    mcp_openai_embedding: true,
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions the API usage but doesn't disclose rate limits, authentication needs, cost implications, error handling, or output format. This is inadequate for a tool that likely involves API calls and computational resources.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Korean that directly states the tool's purpose. It's appropriately sized and front-loaded with no wasted words, though it could be slightly more informative.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a tool that interacts with an external API, the description is incomplete. It lacks critical information about behavioral traits, return values, and usage context, making it insufficient for effective agent operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional semantic context about parameters beyond what's in the schema, such as typical model choices or text formatting. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('create embeddings') and resource ('using OpenAI Embeddings API'), with specific mention of 'text embeddings'. However, it doesn't distinguish this from sibling tools like mcp_openai_chat or mcp_openai_transcribe, which also use OpenAI APIs but for different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention any context, prerequisites, or exclusions, leaving the agent without usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/bigdata-coss/agent_mcp'

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