Skip to main content
Glama
Augmented-Nature

Unofficial PubChem MCP Server

get_compound_properties

Retrieve molecular properties like molecular weight, logP, and TPSA for chemical compounds using PubChem Compound IDs to support chemical analysis and research.

Instructions

Get molecular properties (MW, logP, TPSA, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidYesPubChem Compound ID (CID)
propertiesNoSpecific properties to retrieve (optional)

Implementation Reference

  • The main handler function that validates input arguments using isValidPropertiesArgs, determines the list of properties to fetch (defaults to common molecular descriptors if not specified), queries the PubChem PUG REST API, and returns the properties as formatted JSON text content.
    private async handleGetCompoundProperties(args: any) {
      if (!isValidPropertiesArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid compound properties arguments');
      }
    
      try {
        const properties = args.properties || [
          'MolecularWeight', 'XLogP', 'TPSA', 'HBondDonorCount', 'HBondAcceptorCount',
          'RotatableBondCount', 'Complexity', 'HeavyAtomCount', 'Charge'
        ];
    
        const response = await this.apiClient.get(`/compound/cid/${args.cid}/property/${properties.join(',')}/JSON`);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to get compound properties: ${error instanceof Error ? error.message : 'Unknown error'}`
        );
      }
    }
  • src/index.ts:503-514 (registration)
    Tool registration entry in the ListTools response, defining the tool name, description, and input schema for parameter validation.
    {
      name: 'get_compound_properties',
      description: 'Get molecular properties (MW, logP, TPSA, etc.)',
      inputSchema: {
        type: 'object',
        properties: {
          cid: { type: ['number', 'string'], description: 'PubChem Compound ID (CID)' },
          properties: { type: 'array', items: { type: 'string' }, description: 'Specific properties to retrieve (optional)' },
        },
        required: ['cid'],
      },
    },
  • Type guard function for validating input arguments to the get_compound_properties tool, ensuring cid is provided and properties is an optional string array.
    const isValidPropertiesArgs = (
      args: any
    ): args is { cid: number | string; properties?: string[] } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        (typeof args.cid === 'number' || typeof args.cid === 'string') &&
        (args.properties === undefined || (Array.isArray(args.properties) && args.properties.every((p: any) => typeof p === 'string')))
      );
    };
  • src/index.ts:766-767 (registration)
    Dispatch case in the CallToolRequest handler that routes the tool call to the specific handleGetCompoundProperties method.
    case 'get_compound_properties':
      return await this.handleGetCompoundProperties(args);

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves properties but does not cover critical aspects such as data source, rate limits, error handling, or response format. This leaves significant gaps for an agent to understand how the tool behaves in practice.

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

Conciseness5/5

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

The description is extremely concise—a single sentence that efficiently conveys the core functionality without any wasted words. It is front-loaded with the main action and includes helpful examples, making it easy to parse quickly.

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 the lack of annotations and output schema, the description is incomplete for effective tool use. It does not explain what the return values look like (e.g., format, units), potential limitations, or how it integrates with other tools in the server, leaving the agent with insufficient context.

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?

The input schema has 100% description coverage, clearly documenting both parameters (cid and properties). The description adds minimal value by implying the types of properties (e.g., MW, logP, TPSA) but does not provide additional syntax, constraints, or examples beyond what the schema already specifies.

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 tool's purpose with a specific verb ('Get') and resource ('molecular properties'), and lists examples of properties (MW, logP, TPSA). However, it does not explicitly distinguish this tool from similar siblings like 'calculate_descriptors' or 'get_compound_info', which might also retrieve property-related data.

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?

The description provides no guidance on when to use this tool versus alternatives. With many sibling tools available (e.g., 'calculate_descriptors', 'get_compound_info'), there is no mention of specific contexts, prerequisites, or exclusions to help an agent choose appropriately.

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