new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

LangChain & LangGraph · all subjects

tools & structured output

10 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Managed Deep Agents tool configuration surface

Managed Deep Agents support the normal Deep Agents tools configuration surface. Tools are defined in LangChain and passed to define_deep_agent (Python) or defineDeepAgent (JavaScript).

Python tool definition with @tool decorator

Tools in Python are defined using the @tool decorator from langchain.tools with parse_docstring=True. The function name becomes the tool name and the docstring with Args section defines the parameters.

Python tool example: lookup_customer

from langchain.tools import tool @tool(parse_docstring=True) def lookup_customer(customer_id: str) -> str: """Look up a customer record by ID. Args: customer_id: Customer ID from the CRM. """ return f"Customer {customer_id} is on the enterprise plan."

JavaScript tool definition with tool function

Tools in JavaScript are defined using the tool function from langchain with parameters: an async function, a configuration object with name, description, and a Zod schema for input validation.

JavaScript tool example: lookupCustomer

import { tool } from "langchain"; import { z } from "zod"; export const lookupCustomer = tool( async ({ customerId }) => `Customer ${customerId} is on the enterprise plan.`, { name: "lookup_customer", description: "Look up a customer record by ID.", schema: z.object({ customerId: z.string().describe("Customer ID from the CRM."), }), }, );

Access context from within tools

For per-run values such as request metadata or feature flags, use the normal LangChain runtime context patterns for tools.

Load tools from remote MCP server

To load tools from a remote MCP server instead of defining authored tools, use an MCP connector.

Use clear, unique tool names

Use clear, unique tool names in Managed Deep Agents to avoid collisions between tools.

MCP (Model Context Protocol) tool integration

The Agent Server supports MCP tools with improved input schemas by removing common message types for cleaner definitions. MCP tools undergo name sanitization to ensure valid tool names. The `/tools/call` endpoint accepts an optional `context` parameter enabling middleware to inject runtime context from headers.

Agent Server /mcp endpoint tool descriptions

In v0.2.86, tool descriptions are honored in the /mcp endpoint to align with expected functionality.

Give your agent this brain