ollama-python/examples/README.md
ParthSareen 9a4b946f67 mcp
2025-09-23 16:36:13 -07:00

2.8 KiB

Running Examples

Run the examples in this directory with:

# Run example
python3 examples/<example>.py

See ollama/docs/api.md for full API documentation

Chat - Chat with a model

Generate - Generate text with a model

Tools/Function Calling - Call a function with a model

gpt-oss

Multimodal with Images - Chat with a multimodal (image chat) model

Structured Outputs - Generate structured outputs with a model

Ollama List - List all downloaded models and their properties

Ollama Show - Display model properties and capabilities

Ollama ps - Show model status with CPU/GPU usage

Ollama Pull - Pull a model from Ollama

Requirement: pip install tqdm

Ollama Create - Create a model from a Modelfile

Ollama Embed - Generate embeddings with a model

Thinking - Enable thinking mode for a model

Thinking (generate) - Enable thinking mode for a model

Thinking (levels) - Choose the thinking level

MCP server - Expose web search and crawl tools to MCP clients

Requires: pip install mcp

Run via stdio (for Cursor/Claude MCP):

python3 examples/mcp_web_search_crawl_server.py

Optional environment:

  • OLLAMA_API_KEY: If set, will be passed as an Authorization header for Ollama hosted web search/crawl APIs.