Skip to main content
Glama

query-wolfram-alpha

Answer complex mathematical questions and perform symbolic computations using computational intelligence. Submit queries to solve problems requiring advanced calculation or analysis.

Instructions

Use Wolfram Alpha to answer a question. This tool should be used when you need complex math or symbolic intelligence.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • Executes the 'query-wolfram-alpha' tool: calls the Wolfram client with the query, processes the response pods and subpods to extract plaintext and images (downloading and base64 encoding images), and returns a list of TextContent or ImageContent.
    if name == "query-wolfram-alpha": results: list[types.TextContent | types.ImageContent | types.EmbeddedResource] = [] query = arguments.get("query") if not query: raise ValueError("Missing 'query' parameter for Wolfram Alpha tool") try: response = await client.aquery(query) except Exception as e: raise Exception("Failed to query Wolfram Alpha") from e try: async with httpx.AsyncClient() as http_client: for pod in response.pods: for subpod in pod.subpods: if subpod.plaintext: # Handle text content results.append(types.TextContent( type="text", text=subpod.plaintext )) elif subpod.img: # Handle image content img_url = subpod.img.get("src") if img_url: img_response = await http_client.get(img_url) if img_response.status_code == 200: img_base64 = base64.b64encode(img_response.content).decode('utf-8') results.append(types.ImageContent( type="image", data=img_base64, mimeType="image/png" )) except Exception as e: raise Exception("Failed to parse response from Wolfram Alpha") from e return results
  • Registers the 'query-wolfram-alpha' tool in the list_tools() method, specifying its name, description, and input JSON schema.
    types.Tool( name="query-wolfram-alpha", description="Use Wolfram Alpha to answer a question. This tool should be used when you need complex math or symbolic intelligence.", inputSchema={ "type": "object", "properties": { "query": {"type": "string"} # Correct property: `query` with type `string` }, "required": ["query"] # Marking `query` as required }, ) ]
  • JSON schema for tool input: requires a single 'query' property of type string.
    inputSchema={ "type": "object", "properties": { "query": {"type": "string"} # Correct property: `query` with type `string` }, "required": ["query"] # Marking `query` as required },
  • Imports the WolframAlpha client used by the tool handler to perform the actual API query.
    from .wolfram_client import client

Other 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/SecretiveShell/MCP-wolfram-alpha'

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