Skip to main content
Glama
Augmented-Nature

Unofficial PubChem MCP Server

get_compound_info

Retrieve comprehensive details for a chemical compound using its PubChem CID in formats like JSON, SDF, or XML. Ideal for accessing molecular properties and bioassay data.

Instructions

Get detailed information for a specific compound by PubChem CID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidYesPubChem Compound ID (CID)
formatNoOutput format (default: json)

Implementation Reference

  • The handler function that implements the core logic: validates input with isValidCidArgs, fetches compound data from PubChem API using the provided CID and optional format, formats the response as JSON or raw, and handles errors.
    private async handleGetCompoundInfo(args: any) { if (!isValidCidArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid CID arguments'); } try { const format = args.format || 'json'; const response = await this.apiClient.get(`/compound/cid/${args.cid}/${format === 'json' ? 'JSON' : format}`); return { content: [ { type: 'text', text: format === 'json' ? JSON.stringify(response.data, null, 2) : String(response.data), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to get compound info: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
  • Input schema defining the expected parameters: required 'cid' (number or string), optional 'format' enum for output format.
    inputSchema: { type: 'object', properties: { cid: { type: ['number', 'string'], description: 'PubChem Compound ID (CID)' }, format: { type: 'string', enum: ['json', 'sdf', 'xml', 'asnt', 'asnb'], description: 'Output format (default: json)' }, }, required: ['cid'], },
  • src/index.ts:742-743 (registration)
    Switch case in the request handler that routes calls to 'get_compound_info' to the handleGetCompoundInfo method.
    case 'get_compound_info': return await this.handleGetCompoundInfo(args);
  • src/index.ts:383-394 (registration)
    Tool registration in the listTools response, including name, description, and input schema.
    { name: 'get_compound_info', description: 'Get detailed information for a specific compound by PubChem CID', inputSchema: { type: 'object', properties: { cid: { type: ['number', 'string'], description: 'PubChem Compound ID (CID)' }, format: { type: 'string', enum: ['json', 'sdf', 'xml', 'asnt', 'asnb'], description: 'Output format (default: json)' }, }, required: ['cid'], }, },

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/Augmented-Nature/Augmented-Nature-PubChem-MCP-Server'

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