analyze_stereochemistry
Analyze stereochemistry, chirality, and isomer information for chemical compounds using PubChem CID to identify molecular configurations and structural variations.
Instructions
Analyze stereochemistry, chirality, and isomer information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cid | Yes | PubChem Compound ID (CID) |
Implementation Reference
- src/index.ts:1048-1073 (handler)The handler function that implements the core logic of the 'analyze_stereochemistry' tool. It validates the input CID, queries the PubChem API for stereochemistry properties (AtomStereoCount, DefinedAtomStereoCount, BondStereoCount, DefinedBondStereoCount, IsomericSMILES), and returns the formatted response.private async handleAnalyzeStereochemistry(args: any) { if (!isValidCidArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid stereochemistry arguments'); } try { const response = await this.apiClient.get(`/compound/cid/${args.cid}/property/AtomStereoCount,DefinedAtomStereoCount,BondStereoCount,DefinedBondStereoCount,IsomericSMILES/JSON`); return { content: [ { type: 'text', text: JSON.stringify({ cid: args.cid, stereochemistry: response.data, }, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to analyze stereochemistry: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
- src/index.ts:493-499 (schema)Input schema definition for the tool, specifying that a 'cid' (PubChem Compound ID) is required as number or string.inputSchema: { type: 'object', properties: { cid: { type: ['number', 'string'], description: 'PubChem Compound ID (CID)' }, }, required: ['cid'], },
- src/index.ts:491-500 (registration)Tool registration object added to the MCP server's tools list, including name, description, and input schema.name: 'analyze_stereochemistry', description: 'Analyze stereochemistry, chirality, and isomer information', inputSchema: { type: 'object', properties: { cid: { type: ['number', 'string'], description: 'PubChem Compound ID (CID)' }, }, required: ['cid'], }, },
- src/index.ts:762-763 (registration)Dispatch case in the main request handler that routes calls to the specific handler function.case 'analyze_stereochemistry': return await this.handleAnalyzeStereochemistry(args);